Magellan Linux

Annotation of /trunk/kernel-lts/patches-3.4/0155-3.4.56-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2260 - (hide annotations) (download)
Mon Aug 19 09:25:36 2013 UTC (10 years, 8 months ago) by niro
File size: 51606 byte(s)
-linux-3.4.56
1 niro 2260 diff --git a/Makefile b/Makefile
2     index c11116f..2fe1f6d 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,6 +1,6 @@
6     VERSION = 3
7     PATCHLEVEL = 4
8     -SUBLEVEL = 55
9     +SUBLEVEL = 56
10     EXTRAVERSION =
11     NAME = Saber-toothed Squirrel
12    
13     diff --git a/arch/powerpc/include/asm/module.h b/arch/powerpc/include/asm/module.h
14     index 0192a4e..80de64b 100644
15     --- a/arch/powerpc/include/asm/module.h
16     +++ b/arch/powerpc/include/asm/module.h
17     @@ -87,10 +87,9 @@ struct exception_table_entry;
18     void sort_ex_table(struct exception_table_entry *start,
19     struct exception_table_entry *finish);
20    
21     -#ifdef CONFIG_MODVERSIONS
22     +#if defined(CONFIG_MODVERSIONS) && defined(CONFIG_PPC64)
23     #define ARCH_RELOCATES_KCRCTAB
24     -
25     -extern const unsigned long reloc_start[];
26     +#define reloc_start PHYSICAL_START
27     #endif
28     #endif /* __KERNEL__ */
29     #endif /* _ASM_POWERPC_MODULE_H */
30     diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
31     index 65d1c08..7703569 100644
32     --- a/arch/powerpc/kernel/vmlinux.lds.S
33     +++ b/arch/powerpc/kernel/vmlinux.lds.S
34     @@ -38,9 +38,6 @@ jiffies = jiffies_64 + 4;
35     #endif
36     SECTIONS
37     {
38     - . = 0;
39     - reloc_start = .;
40     -
41     . = KERNELBASE;
42    
43     /*
44     diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
45     index 011358c..2f36a66 100644
46     --- a/arch/s390/include/asm/pgtable.h
47     +++ b/arch/s390/include/asm/pgtable.h
48     @@ -67,6 +67,10 @@ static inline int is_zero_pfn(unsigned long pfn)
49    
50     #define my_zero_pfn(addr) page_to_pfn(ZERO_PAGE(addr))
51    
52     +/* TODO: s390 cannot support io_remap_pfn_range... */
53     +#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
54     + remap_pfn_range(vma, vaddr, pfn, size, prot)
55     +
56     #endif /* !__ASSEMBLY__ */
57    
58     /*
59     diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
60     index d985713..f81597f 100644
61     --- a/drivers/acpi/acpi_memhotplug.c
62     +++ b/drivers/acpi/acpi_memhotplug.c
63     @@ -421,6 +421,7 @@ static int acpi_memory_device_add(struct acpi_device *device)
64     /* Get the range from the _CRS */
65     result = acpi_memory_get_device_resources(mem_device);
66     if (result) {
67     + device->driver_data = NULL;
68     kfree(mem_device);
69     return result;
70     }
71     diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
72     index 6bdedd7..1ad34ed 100644
73     --- a/drivers/ata/Kconfig
74     +++ b/drivers/ata/Kconfig
75     @@ -93,7 +93,7 @@ config SATA_FSL
76     If unsure, say N.
77    
78     config SATA_INIC162X
79     - tristate "Initio 162x SATA support"
80     + tristate "Initio 162x SATA support (Very Experimental)"
81     depends on PCI
82     help
83     This option enables support for Initio 162x Serial ATA.
84     diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
85     index 45cc02b..9dbd3ae 100644
86     --- a/drivers/ata/ata_piix.c
87     +++ b/drivers/ata/ata_piix.c
88     @@ -344,7 +344,7 @@ static const struct pci_device_id piix_pci_tbl[] = {
89     /* SATA Controller IDE (Wellsburg) */
90     { 0x8086, 0x8d00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb },
91     /* SATA Controller IDE (Wellsburg) */
92     - { 0x8086, 0x8d08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
93     + { 0x8086, 0x8d08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_snb },
94     /* SATA Controller IDE (Wellsburg) */
95     { 0x8086, 0x8d60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb },
96     /* SATA Controller IDE (Wellsburg) */
97     diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
98     index 5c7d70c..3a8b55e 100644
99     --- a/drivers/ata/sata_inic162x.c
100     +++ b/drivers/ata/sata_inic162x.c
101     @@ -6,6 +6,18 @@
102     *
103     * This file is released under GPL v2.
104     *
105     + * **** WARNING ****
106     + *
107     + * This driver never worked properly and unfortunately data corruption is
108     + * relatively common. There isn't anyone working on the driver and there's
109     + * no support from the vendor. Do not use this driver in any production
110     + * environment.
111     + *
112     + * http://thread.gmane.org/gmane.linux.debian.devel.bugs.rc/378525/focus=54491
113     + * https://bugzilla.kernel.org/show_bug.cgi?id=60565
114     + *
115     + * *****************
116     + *
117     * This controller is eccentric and easily locks up if something isn't
118     * right. Documentation is available at initio's website but it only
119     * documents registers (not programming model).
120     @@ -809,6 +821,8 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
121    
122     ata_print_version_once(&pdev->dev, DRV_VERSION);
123    
124     + dev_alert(&pdev->dev, "inic162x support is broken with common data corruption issues and will be disabled by default, contact linux-ide@vger.kernel.org if in production use\n");
125     +
126     /* alloc host */
127     host = ata_host_alloc_pinfo(&pdev->dev, ppi, NR_PORTS);
128     hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL);
129     diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
130     index 4fd1dea..4ed7bf9 100644
131     --- a/drivers/block/xen-blkback/blkback.c
132     +++ b/drivers/block/xen-blkback/blkback.c
133     @@ -399,7 +399,18 @@ static int dispatch_discard_io(struct xen_blkif *blkif,
134     int status = BLKIF_RSP_OKAY;
135     struct block_device *bdev = blkif->vbd.bdev;
136     unsigned long secure;
137     + struct phys_req preq;
138     +
139     + preq.sector_number = req->u.discard.sector_number;
140     + preq.nr_sects = req->u.discard.nr_sectors;
141    
142     + err = xen_vbd_translate(&preq, blkif, WRITE);
143     + if (err) {
144     + pr_warn(DRV_PFX "access denied: DISCARD [%llu->%llu] on dev=%04x\n",
145     + preq.sector_number,
146     + preq.sector_number + preq.nr_sects, blkif->vbd.pdevice);
147     + goto fail_response;
148     + }
149     blkif->st_ds_req++;
150    
151     xen_blkif_get(blkif);
152     @@ -410,7 +421,7 @@ static int dispatch_discard_io(struct xen_blkif *blkif,
153     err = blkdev_issue_discard(bdev, req->u.discard.sector_number,
154     req->u.discard.nr_sectors,
155     GFP_KERNEL, secure);
156     -
157     +fail_response:
158     if (err == -EOPNOTSUPP) {
159     pr_debug(DRV_PFX "discard op failed, not supported\n");
160     status = BLKIF_RSP_EOPNOTSUPP;
161     diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c
162     index b8e4809..b558810 100644
163     --- a/drivers/firewire/core-cdev.c
164     +++ b/drivers/firewire/core-cdev.c
165     @@ -53,6 +53,7 @@
166     #define FW_CDEV_KERNEL_VERSION 5
167     #define FW_CDEV_VERSION_EVENT_REQUEST2 4
168     #define FW_CDEV_VERSION_ALLOCATE_REGION_END 4
169     +#define FW_CDEV_VERSION_AUTO_FLUSH_ISO_OVERFLOW 5
170    
171     struct client {
172     u32 version;
173     @@ -998,6 +999,8 @@ static int ioctl_create_iso_context(struct client *client, union ioctl_arg *arg)
174     a->channel, a->speed, a->header_size, cb, client);
175     if (IS_ERR(context))
176     return PTR_ERR(context);
177     + if (client->version < FW_CDEV_VERSION_AUTO_FLUSH_ISO_OVERFLOW)
178     + context->drop_overflow_headers = true;
179    
180     /* We only support one context at this time. */
181     spin_lock_irq(&client->lock);
182     diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
183     index 2b54600..c1de4c3 100644
184     --- a/drivers/firewire/ohci.c
185     +++ b/drivers/firewire/ohci.c
186     @@ -2694,8 +2694,11 @@ static void copy_iso_headers(struct iso_context *ctx, const u32 *dma_hdr)
187     {
188     u32 *ctx_hdr;
189    
190     - if (ctx->header_length + ctx->base.header_size > PAGE_SIZE)
191     + if (ctx->header_length + ctx->base.header_size > PAGE_SIZE) {
192     + if (ctx->base.drop_overflow_headers)
193     + return;
194     flush_iso_completions(ctx);
195     + }
196    
197     ctx_hdr = ctx->header + ctx->header_length;
198     ctx->last_timestamp = (u16)le32_to_cpu((__force __le32)dma_hdr[0]);
199     @@ -2855,8 +2858,11 @@ static int handle_it_packet(struct context *context,
200    
201     sync_it_packet_for_cpu(context, d);
202    
203     - if (ctx->header_length + 4 > PAGE_SIZE)
204     + if (ctx->header_length + 4 > PAGE_SIZE) {
205     + if (ctx->base.drop_overflow_headers)
206     + return 1;
207     flush_iso_completions(ctx);
208     + }
209    
210     ctx_hdr = ctx->header + ctx->header_length;
211     ctx->last_timestamp = le16_to_cpu(last->res_count);
212     diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
213     index 43672b6..daa1e34 100644
214     --- a/drivers/gpu/drm/radeon/atom.c
215     +++ b/drivers/gpu/drm/radeon/atom.c
216     @@ -1222,12 +1222,17 @@ int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params)
217     int r;
218    
219     mutex_lock(&ctx->mutex);
220     + /* reset data block */
221     + ctx->data_block = 0;
222     /* reset reg block */
223     ctx->reg_block = 0;
224     /* reset fb window */
225     ctx->fb_base = 0;
226     /* reset io mode */
227     ctx->io_mode = ATOM_IO_MM;
228     + /* reset divmul */
229     + ctx->divmul[0] = 0;
230     + ctx->divmul[1] = 0;
231     r = atom_execute_table_locked(ctx, index, params);
232     mutex_unlock(&ctx->mutex);
233     return r;
234     diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
235     index 886b41f..505f27e 100644
236     --- a/drivers/gpu/drm/radeon/atombios_dp.c
237     +++ b/drivers/gpu/drm/radeon/atombios_dp.c
238     @@ -45,6 +45,41 @@ static char *pre_emph_names[] = {
239     };
240    
241     /***** radeon AUX functions *****/
242     +
243     +/* Atom needs data in little endian format
244     + * so swap as appropriate when copying data to
245     + * or from atom. Note that atom operates on
246     + * dw units.
247     + */
248     +static void radeon_copy_swap(u8 *dst, u8 *src, u8 num_bytes, bool to_le)
249     +{
250     +#ifdef __BIG_ENDIAN
251     + u8 src_tmp[20], dst_tmp[20]; /* used for byteswapping */
252     + u32 *dst32, *src32;
253     + int i;
254     +
255     + memcpy(src_tmp, src, num_bytes);
256     + src32 = (u32 *)src_tmp;
257     + dst32 = (u32 *)dst_tmp;
258     + if (to_le) {
259     + for (i = 0; i < ((num_bytes + 3) / 4); i++)
260     + dst32[i] = cpu_to_le32(src32[i]);
261     + memcpy(dst, dst_tmp, num_bytes);
262     + } else {
263     + u8 dws = num_bytes & ~3;
264     + for (i = 0; i < ((num_bytes + 3) / 4); i++)
265     + dst32[i] = le32_to_cpu(src32[i]);
266     + memcpy(dst, dst_tmp, dws);
267     + if (num_bytes % 4) {
268     + for (i = 0; i < (num_bytes % 4); i++)
269     + dst[dws+i] = dst_tmp[dws+i];
270     + }
271     + }
272     +#else
273     + memcpy(dst, src, num_bytes);
274     +#endif
275     +}
276     +
277     union aux_channel_transaction {
278     PROCESS_AUX_CHANNEL_TRANSACTION_PS_ALLOCATION v1;
279     PROCESS_AUX_CHANNEL_TRANSACTION_PARAMETERS_V2 v2;
280     @@ -66,10 +101,10 @@ static int radeon_process_aux_ch(struct radeon_i2c_chan *chan,
281    
282     base = (unsigned char *)(rdev->mode_info.atom_context->scratch + 1);
283    
284     - memcpy(base, send, send_bytes);
285     + radeon_copy_swap(base, send, send_bytes, true);
286    
287     - args.v1.lpAuxRequest = 0 + 4;
288     - args.v1.lpDataOut = 16 + 4;
289     + args.v1.lpAuxRequest = cpu_to_le16((u16)(0 + 4));
290     + args.v1.lpDataOut = cpu_to_le16((u16)(16 + 4));
291     args.v1.ucDataOutLen = 0;
292     args.v1.ucChannelID = chan->rec.i2c_id;
293     args.v1.ucDelay = delay / 10;
294     @@ -103,7 +138,7 @@ static int radeon_process_aux_ch(struct radeon_i2c_chan *chan,
295     recv_bytes = recv_size;
296    
297     if (recv && recv_size)
298     - memcpy(recv, base + 16, recv_bytes);
299     + radeon_copy_swap(recv, base + 16, recv_bytes, false);
300    
301     return recv_bytes;
302     }
303     diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
304     index 2b2c557..07d0bcd 100644
305     --- a/drivers/gpu/drm/radeon/radeon_combios.c
306     +++ b/drivers/gpu/drm/radeon/radeon_combios.c
307     @@ -147,7 +147,7 @@ static uint16_t combios_get_table_offset(struct drm_device *dev,
308     enum radeon_combios_table_offset table)
309     {
310     struct radeon_device *rdev = dev->dev_private;
311     - int rev;
312     + int rev, size;
313     uint16_t offset = 0, check_offset;
314    
315     if (!rdev->bios)
316     @@ -156,174 +156,106 @@ static uint16_t combios_get_table_offset(struct drm_device *dev,
317     switch (table) {
318     /* absolute offset tables */
319     case COMBIOS_ASIC_INIT_1_TABLE:
320     - check_offset = RBIOS16(rdev->bios_header_start + 0xc);
321     - if (check_offset)
322     - offset = check_offset;
323     + check_offset = 0xc;
324     break;
325     case COMBIOS_BIOS_SUPPORT_TABLE:
326     - check_offset = RBIOS16(rdev->bios_header_start + 0x14);
327     - if (check_offset)
328     - offset = check_offset;
329     + check_offset = 0x14;
330     break;
331     case COMBIOS_DAC_PROGRAMMING_TABLE:
332     - check_offset = RBIOS16(rdev->bios_header_start + 0x2a);
333     - if (check_offset)
334     - offset = check_offset;
335     + check_offset = 0x2a;
336     break;
337     case COMBIOS_MAX_COLOR_DEPTH_TABLE:
338     - check_offset = RBIOS16(rdev->bios_header_start + 0x2c);
339     - if (check_offset)
340     - offset = check_offset;
341     + check_offset = 0x2c;
342     break;
343     case COMBIOS_CRTC_INFO_TABLE:
344     - check_offset = RBIOS16(rdev->bios_header_start + 0x2e);
345     - if (check_offset)
346     - offset = check_offset;
347     + check_offset = 0x2e;
348     break;
349     case COMBIOS_PLL_INFO_TABLE:
350     - check_offset = RBIOS16(rdev->bios_header_start + 0x30);
351     - if (check_offset)
352     - offset = check_offset;
353     + check_offset = 0x30;
354     break;
355     case COMBIOS_TV_INFO_TABLE:
356     - check_offset = RBIOS16(rdev->bios_header_start + 0x32);
357     - if (check_offset)
358     - offset = check_offset;
359     + check_offset = 0x32;
360     break;
361     case COMBIOS_DFP_INFO_TABLE:
362     - check_offset = RBIOS16(rdev->bios_header_start + 0x34);
363     - if (check_offset)
364     - offset = check_offset;
365     + check_offset = 0x34;
366     break;
367     case COMBIOS_HW_CONFIG_INFO_TABLE:
368     - check_offset = RBIOS16(rdev->bios_header_start + 0x36);
369     - if (check_offset)
370     - offset = check_offset;
371     + check_offset = 0x36;
372     break;
373     case COMBIOS_MULTIMEDIA_INFO_TABLE:
374     - check_offset = RBIOS16(rdev->bios_header_start + 0x38);
375     - if (check_offset)
376     - offset = check_offset;
377     + check_offset = 0x38;
378     break;
379     case COMBIOS_TV_STD_PATCH_TABLE:
380     - check_offset = RBIOS16(rdev->bios_header_start + 0x3e);
381     - if (check_offset)
382     - offset = check_offset;
383     + check_offset = 0x3e;
384     break;
385     case COMBIOS_LCD_INFO_TABLE:
386     - check_offset = RBIOS16(rdev->bios_header_start + 0x40);
387     - if (check_offset)
388     - offset = check_offset;
389     + check_offset = 0x40;
390     break;
391     case COMBIOS_MOBILE_INFO_TABLE:
392     - check_offset = RBIOS16(rdev->bios_header_start + 0x42);
393     - if (check_offset)
394     - offset = check_offset;
395     + check_offset = 0x42;
396     break;
397     case COMBIOS_PLL_INIT_TABLE:
398     - check_offset = RBIOS16(rdev->bios_header_start + 0x46);
399     - if (check_offset)
400     - offset = check_offset;
401     + check_offset = 0x46;
402     break;
403     case COMBIOS_MEM_CONFIG_TABLE:
404     - check_offset = RBIOS16(rdev->bios_header_start + 0x48);
405     - if (check_offset)
406     - offset = check_offset;
407     + check_offset = 0x48;
408     break;
409     case COMBIOS_SAVE_MASK_TABLE:
410     - check_offset = RBIOS16(rdev->bios_header_start + 0x4a);
411     - if (check_offset)
412     - offset = check_offset;
413     + check_offset = 0x4a;
414     break;
415     case COMBIOS_HARDCODED_EDID_TABLE:
416     - check_offset = RBIOS16(rdev->bios_header_start + 0x4c);
417     - if (check_offset)
418     - offset = check_offset;
419     + check_offset = 0x4c;
420     break;
421     case COMBIOS_ASIC_INIT_2_TABLE:
422     - check_offset = RBIOS16(rdev->bios_header_start + 0x4e);
423     - if (check_offset)
424     - offset = check_offset;
425     + check_offset = 0x4e;
426     break;
427     case COMBIOS_CONNECTOR_INFO_TABLE:
428     - check_offset = RBIOS16(rdev->bios_header_start + 0x50);
429     - if (check_offset)
430     - offset = check_offset;
431     + check_offset = 0x50;
432     break;
433     case COMBIOS_DYN_CLK_1_TABLE:
434     - check_offset = RBIOS16(rdev->bios_header_start + 0x52);
435     - if (check_offset)
436     - offset = check_offset;
437     + check_offset = 0x52;
438     break;
439     case COMBIOS_RESERVED_MEM_TABLE:
440     - check_offset = RBIOS16(rdev->bios_header_start + 0x54);
441     - if (check_offset)
442     - offset = check_offset;
443     + check_offset = 0x54;
444     break;
445     case COMBIOS_EXT_TMDS_INFO_TABLE:
446     - check_offset = RBIOS16(rdev->bios_header_start + 0x58);
447     - if (check_offset)
448     - offset = check_offset;
449     + check_offset = 0x58;
450     break;
451     case COMBIOS_MEM_CLK_INFO_TABLE:
452     - check_offset = RBIOS16(rdev->bios_header_start + 0x5a);
453     - if (check_offset)
454     - offset = check_offset;
455     + check_offset = 0x5a;
456     break;
457     case COMBIOS_EXT_DAC_INFO_TABLE:
458     - check_offset = RBIOS16(rdev->bios_header_start + 0x5c);
459     - if (check_offset)
460     - offset = check_offset;
461     + check_offset = 0x5c;
462     break;
463     case COMBIOS_MISC_INFO_TABLE:
464     - check_offset = RBIOS16(rdev->bios_header_start + 0x5e);
465     - if (check_offset)
466     - offset = check_offset;
467     + check_offset = 0x5e;
468     break;
469     case COMBIOS_CRT_INFO_TABLE:
470     - check_offset = RBIOS16(rdev->bios_header_start + 0x60);
471     - if (check_offset)
472     - offset = check_offset;
473     + check_offset = 0x60;
474     break;
475     case COMBIOS_INTEGRATED_SYSTEM_INFO_TABLE:
476     - check_offset = RBIOS16(rdev->bios_header_start + 0x62);
477     - if (check_offset)
478     - offset = check_offset;
479     + check_offset = 0x62;
480     break;
481     case COMBIOS_COMPONENT_VIDEO_INFO_TABLE:
482     - check_offset = RBIOS16(rdev->bios_header_start + 0x64);
483     - if (check_offset)
484     - offset = check_offset;
485     + check_offset = 0x64;
486     break;
487     case COMBIOS_FAN_SPEED_INFO_TABLE:
488     - check_offset = RBIOS16(rdev->bios_header_start + 0x66);
489     - if (check_offset)
490     - offset = check_offset;
491     + check_offset = 0x66;
492     break;
493     case COMBIOS_OVERDRIVE_INFO_TABLE:
494     - check_offset = RBIOS16(rdev->bios_header_start + 0x68);
495     - if (check_offset)
496     - offset = check_offset;
497     + check_offset = 0x68;
498     break;
499     case COMBIOS_OEM_INFO_TABLE:
500     - check_offset = RBIOS16(rdev->bios_header_start + 0x6a);
501     - if (check_offset)
502     - offset = check_offset;
503     + check_offset = 0x6a;
504     break;
505     case COMBIOS_DYN_CLK_2_TABLE:
506     - check_offset = RBIOS16(rdev->bios_header_start + 0x6c);
507     - if (check_offset)
508     - offset = check_offset;
509     + check_offset = 0x6c;
510     break;
511     case COMBIOS_POWER_CONNECTOR_INFO_TABLE:
512     - check_offset = RBIOS16(rdev->bios_header_start + 0x6e);
513     - if (check_offset)
514     - offset = check_offset;
515     + check_offset = 0x6e;
516     break;
517     case COMBIOS_I2C_INFO_TABLE:
518     - check_offset = RBIOS16(rdev->bios_header_start + 0x70);
519     - if (check_offset)
520     - offset = check_offset;
521     + check_offset = 0x70;
522     break;
523     /* relative offset tables */
524     case COMBIOS_ASIC_INIT_3_TABLE: /* offset from misc info */
525     @@ -439,11 +371,16 @@ static uint16_t combios_get_table_offset(struct drm_device *dev,
526     }
527     break;
528     default:
529     + check_offset = 0;
530     break;
531     }
532    
533     - return offset;
534     + size = RBIOS8(rdev->bios_header_start + 0x6);
535     + /* check absolute offset tables */
536     + if (table < COMBIOS_ASIC_INIT_3_TABLE && check_offset && check_offset < size)
537     + offset = RBIOS16(rdev->bios_header_start + check_offset);
538    
539     + return offset;
540     }
541    
542     bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev)
543     @@ -953,8 +890,10 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
544     dac = RBIOS8(dac_info + 0x3) & 0xf;
545     p_dac->ps2_pdac_adj = (bg << 8) | (dac);
546     }
547     - /* if the values are all zeros, use the table */
548     - if (p_dac->ps2_pdac_adj)
549     + /* if the values are zeros, use the table */
550     + if ((dac == 0) || (bg == 0))
551     + found = 0;
552     + else
553     found = 1;
554     }
555    
556     diff --git a/drivers/md/dm-verity.c b/drivers/md/dm-verity.c
557     index 68bf5c3..9ab2a6a 100644
558     --- a/drivers/md/dm-verity.c
559     +++ b/drivers/md/dm-verity.c
560     @@ -813,9 +813,8 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv)
561     for (i = v->levels - 1; i >= 0; i--) {
562     sector_t s;
563     v->hash_level_block[i] = hash_position;
564     - s = verity_position_at_level(v, v->data_blocks, i);
565     - s = (s >> v->hash_per_block_bits) +
566     - !!(s & ((1 << v->hash_per_block_bits) - 1));
567     + s = (v->data_blocks + ((sector_t)1 << ((i + 1) * v->hash_per_block_bits)) - 1)
568     + >> ((i + 1) * v->hash_per_block_bits);
569     if (hash_position + s < hash_position) {
570     ti->error = "Hash device offset overflow";
571     r = -E2BIG;
572     diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
573     index 0cc7985..54ba531 100644
574     --- a/drivers/md/raid10.c
575     +++ b/drivers/md/raid10.c
576     @@ -2029,12 +2029,18 @@ static void recovery_request_write(struct mddev *mddev, struct r10bio *r10_bio)
577     d = r10_bio->devs[1].devnum;
578     wbio = r10_bio->devs[1].bio;
579     wbio2 = r10_bio->devs[1].repl_bio;
580     + /* Need to test wbio2->bi_end_io before we call
581     + * generic_make_request as if the former is NULL,
582     + * the latter is free to free wbio2.
583     + */
584     + if (wbio2 && !wbio2->bi_end_io)
585     + wbio2 = NULL;
586     if (wbio->bi_end_io) {
587     atomic_inc(&conf->mirrors[d].rdev->nr_pending);
588     md_sync_acct(conf->mirrors[d].rdev->bdev, wbio->bi_size >> 9);
589     generic_make_request(wbio);
590     }
591     - if (wbio2 && wbio2->bi_end_io) {
592     + if (wbio2) {
593     atomic_inc(&conf->mirrors[d].replacement->nr_pending);
594     md_sync_acct(conf->mirrors[d].replacement->bdev,
595     wbio2->bi_size >> 9);
596     diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
597     index 0240576..6155c8b 100644
598     --- a/drivers/md/raid5.c
599     +++ b/drivers/md/raid5.c
600     @@ -3326,6 +3326,7 @@ static void handle_stripe(struct stripe_head *sh)
601     if (test_and_clear_bit(STRIPE_SYNC_REQUESTED, &sh->state)) {
602     set_bit(STRIPE_SYNCING, &sh->state);
603     clear_bit(STRIPE_INSYNC, &sh->state);
604     + clear_bit(STRIPE_REPLACED, &sh->state);
605     }
606     clear_bit(STRIPE_DELAYED, &sh->state);
607    
608     @@ -3465,19 +3466,23 @@ static void handle_stripe(struct stripe_head *sh)
609     handle_parity_checks5(conf, sh, &s, disks);
610     }
611    
612     - if (s.replacing && s.locked == 0
613     - && !test_bit(STRIPE_INSYNC, &sh->state)) {
614     + if ((s.replacing || s.syncing) && s.locked == 0
615     + && !test_bit(STRIPE_COMPUTE_RUN, &sh->state)
616     + && !test_bit(STRIPE_REPLACED, &sh->state)) {
617     /* Write out to replacement devices where possible */
618     for (i = 0; i < conf->raid_disks; i++)
619     - if (test_bit(R5_UPTODATE, &sh->dev[i].flags) &&
620     - test_bit(R5_NeedReplace, &sh->dev[i].flags)) {
621     + if (test_bit(R5_NeedReplace, &sh->dev[i].flags)) {
622     + WARN_ON(!test_bit(R5_UPTODATE, &sh->dev[i].flags));
623     set_bit(R5_WantReplace, &sh->dev[i].flags);
624     set_bit(R5_LOCKED, &sh->dev[i].flags);
625     s.locked++;
626     }
627     - set_bit(STRIPE_INSYNC, &sh->state);
628     + if (s.replacing)
629     + set_bit(STRIPE_INSYNC, &sh->state);
630     + set_bit(STRIPE_REPLACED, &sh->state);
631     }
632     if ((s.syncing || s.replacing) && s.locked == 0 &&
633     + !test_bit(STRIPE_COMPUTE_RUN, &sh->state) &&
634     test_bit(STRIPE_INSYNC, &sh->state)) {
635     md_done_sync(conf->mddev, STRIPE_SECTORS, 1);
636     clear_bit(STRIPE_SYNCING, &sh->state);
637     diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
638     index 8d8e139..f1ed18e 100644
639     --- a/drivers/md/raid5.h
640     +++ b/drivers/md/raid5.h
641     @@ -306,6 +306,7 @@ enum {
642     STRIPE_SYNC_REQUESTED,
643     STRIPE_SYNCING,
644     STRIPE_INSYNC,
645     + STRIPE_REPLACED,
646     STRIPE_PREREAD_ACTIVE,
647     STRIPE_DELAYED,
648     STRIPE_DEGRADED,
649     diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
650     index cbefe67..bc177b9 100644
651     --- a/drivers/net/virtio_net.c
652     +++ b/drivers/net/virtio_net.c
653     @@ -518,7 +518,7 @@ static int virtnet_poll(struct napi_struct *napi, int budget)
654     {
655     struct virtnet_info *vi = container_of(napi, struct virtnet_info, napi);
656     void *buf;
657     - unsigned int len, received = 0;
658     + unsigned int r, len, received = 0;
659    
660     again:
661     while (received < budget &&
662     @@ -535,8 +535,9 @@ again:
663    
664     /* Out of packets? */
665     if (received < budget) {
666     + r = virtqueue_enable_cb_prepare(vi->rvq);
667     napi_complete(napi);
668     - if (unlikely(!virtqueue_enable_cb(vi->rvq)) &&
669     + if (unlikely(virtqueue_poll(vi->rvq, r)) &&
670     napi_schedule_prep(napi)) {
671     virtqueue_disable_cb(vi->rvq);
672     __napi_schedule(napi);
673     diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
674     index 4f1b10b..3743ac9 100644
675     --- a/drivers/s390/scsi/zfcp_aux.c
676     +++ b/drivers/s390/scsi/zfcp_aux.c
677     @@ -3,7 +3,7 @@
678     *
679     * Module interface and handling of zfcp data structures.
680     *
681     - * Copyright IBM Corporation 2002, 2010
682     + * Copyright IBM Corp. 2002, 2013
683     */
684    
685     /*
686     @@ -23,6 +23,7 @@
687     * Christof Schmitt
688     * Martin Petermann
689     * Sven Schuetz
690     + * Steffen Maier
691     */
692    
693     #define KMSG_COMPONENT "zfcp"
694     @@ -415,6 +416,8 @@ struct zfcp_adapter *zfcp_adapter_enqueue(struct ccw_device *ccw_device)
695     adapter->dma_parms.max_segment_size = ZFCP_QDIO_SBALE_LEN;
696     adapter->ccw_device->dev.dma_parms = &adapter->dma_parms;
697    
698     + adapter->stat_read_buf_num = FSF_STATUS_READS_RECOM;
699     +
700     if (!zfcp_scsi_adapter_register(adapter))
701     return adapter;
702    
703     diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
704     index 5fdf70b..961e327 100644
705     --- a/drivers/s390/scsi/zfcp_fsf.c
706     +++ b/drivers/s390/scsi/zfcp_fsf.c
707     @@ -3,7 +3,7 @@
708     *
709     * Implementation of FSF commands.
710     *
711     - * Copyright IBM Corporation 2002, 2010
712     + * Copyright IBM Corp. 2002, 2013
713     */
714    
715     #define KMSG_COMPONENT "zfcp"
716     @@ -483,12 +483,8 @@ static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req)
717    
718     fc_host_port_name(shost) = nsp->fl_wwpn;
719     fc_host_node_name(shost) = nsp->fl_wwnn;
720     - fc_host_port_id(shost) = ntoh24(bottom->s_id);
721     - fc_host_speed(shost) =
722     - zfcp_fsf_convert_portspeed(bottom->fc_link_speed);
723     fc_host_supported_classes(shost) = FC_COS_CLASS2 | FC_COS_CLASS3;
724    
725     - adapter->hydra_version = bottom->adapter_type;
726     adapter->timer_ticks = bottom->timer_interval & ZFCP_FSF_TIMER_INT_MASK;
727     adapter->stat_read_buf_num = max(bottom->status_read_buf_num,
728     (u16)FSF_STATUS_READS_RECOM);
729     @@ -496,6 +492,19 @@ static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req)
730     if (fc_host_permanent_port_name(shost) == -1)
731     fc_host_permanent_port_name(shost) = fc_host_port_name(shost);
732    
733     + zfcp_scsi_set_prot(adapter);
734     +
735     + /* no error return above here, otherwise must fix call chains */
736     + /* do not evaluate invalid fields */
737     + if (req->qtcb->header.fsf_status == FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE)
738     + return 0;
739     +
740     + fc_host_port_id(shost) = ntoh24(bottom->s_id);
741     + fc_host_speed(shost) =
742     + zfcp_fsf_convert_portspeed(bottom->fc_link_speed);
743     +
744     + adapter->hydra_version = bottom->adapter_type;
745     +
746     switch (bottom->fc_topology) {
747     case FSF_TOPO_P2P:
748     adapter->peer_d_id = ntoh24(bottom->peer_d_id);
749     @@ -517,8 +526,6 @@ static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req)
750     return -EIO;
751     }
752    
753     - zfcp_scsi_set_prot(adapter);
754     -
755     return 0;
756     }
757    
758     @@ -569,6 +576,8 @@ static void zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *req)
759     &adapter->status);
760     zfcp_fsf_link_down_info_eval(req,
761     &qtcb->header.fsf_status_qual.link_down_info);
762     + if (zfcp_fsf_exchange_config_evaluate(req))
763     + return;
764     break;
765     default:
766     zfcp_erp_adapter_shutdown(adapter, 0, "fsecdh3");
767     diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
768     index eac9509..d99d4a0 100644
769     --- a/drivers/scsi/qla2xxx/qla_iocb.c
770     +++ b/drivers/scsi/qla2xxx/qla_iocb.c
771     @@ -423,6 +423,8 @@ qla2x00_start_scsi(srb_t *sp)
772     __constant_cpu_to_le16(CF_SIMPLE_TAG);
773     break;
774     }
775     + } else {
776     + cmd_pkt->control_flags = __constant_cpu_to_le16(CF_SIMPLE_TAG);
777     }
778    
779     /* Load SCSI command packet. */
780     @@ -1331,11 +1333,11 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
781     fcp_cmnd->task_attribute = TSK_ORDERED;
782     break;
783     default:
784     - fcp_cmnd->task_attribute = 0;
785     + fcp_cmnd->task_attribute = TSK_SIMPLE;
786     break;
787     }
788     } else {
789     - fcp_cmnd->task_attribute = 0;
790     + fcp_cmnd->task_attribute = TSK_SIMPLE;
791     }
792    
793     cmd_pkt->fcp_rsp_dseg_len = 0; /* Let response come in status iocb */
794     @@ -1541,7 +1543,12 @@ qla24xx_start_scsi(srb_t *sp)
795     case ORDERED_QUEUE_TAG:
796     cmd_pkt->task = TSK_ORDERED;
797     break;
798     + default:
799     + cmd_pkt->task = TSK_SIMPLE;
800     + break;
801     }
802     + } else {
803     + cmd_pkt->task = TSK_SIMPLE;
804     }
805    
806     /* Load SCSI command packet. */
807     diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
808     index 3141c1a..105fff2 100644
809     --- a/drivers/scsi/sd.c
810     +++ b/drivers/scsi/sd.c
811     @@ -672,10 +672,17 @@ static int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct request *rq)
812    
813     static void sd_unprep_fn(struct request_queue *q, struct request *rq)
814     {
815     + struct scsi_cmnd *SCpnt = rq->special;
816     +
817     if (rq->cmd_flags & REQ_DISCARD) {
818     free_page((unsigned long)rq->buffer);
819     rq->buffer = NULL;
820     }
821     + if (SCpnt->cmnd != rq->cmd) {
822     + mempool_free(SCpnt->cmnd, sd_cdb_pool);
823     + SCpnt->cmnd = NULL;
824     + SCpnt->cmd_len = 0;
825     + }
826     }
827    
828     /**
829     @@ -1539,21 +1546,6 @@ static int sd_done(struct scsi_cmnd *SCpnt)
830     if (rq_data_dir(SCpnt->request) == READ && scsi_prot_sg_count(SCpnt))
831     sd_dif_complete(SCpnt, good_bytes);
832    
833     - if (scsi_host_dif_capable(sdkp->device->host, sdkp->protection_type)
834     - == SD_DIF_TYPE2_PROTECTION && SCpnt->cmnd != SCpnt->request->cmd) {
835     -
836     - /* We have to print a failed command here as the
837     - * extended CDB gets freed before scsi_io_completion()
838     - * is called.
839     - */
840     - if (result)
841     - scsi_print_command(SCpnt);
842     -
843     - mempool_free(SCpnt->cmnd, sd_cdb_pool);
844     - SCpnt->cmnd = NULL;
845     - SCpnt->cmd_len = 0;
846     - }
847     -
848     return good_bytes;
849     }
850    
851     diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
852     index 3799cf1..50dc93e 100644
853     --- a/drivers/staging/comedi/comedi_fops.c
854     +++ b/drivers/staging/comedi/comedi_fops.c
855     @@ -1370,6 +1370,7 @@ static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg,
856     void *file)
857     {
858     struct comedi_subdevice *s;
859     + int ret;
860    
861     if (arg >= dev->n_subdevices)
862     return -EINVAL;
863     @@ -1386,7 +1387,11 @@ static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg,
864     if (s->busy != file)
865     return -EBUSY;
866    
867     - return do_cancel(dev, s);
868     + ret = do_cancel(dev, s);
869     + if (comedi_get_subdevice_runflags(s) & SRF_USER)
870     + wake_up_interruptible(&s->async->wait_head);
871     +
872     + return ret;
873     }
874    
875     /*
876     diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c
877     index 00c58cc..facb3ad 100644
878     --- a/drivers/target/iscsi/iscsi_target_configfs.c
879     +++ b/drivers/target/iscsi/iscsi_target_configfs.c
880     @@ -415,7 +415,7 @@ static ssize_t __iscsi_##prefix##_store_##name( \
881     if (!capable(CAP_SYS_ADMIN)) \
882     return -EPERM; \
883     \
884     - snprintf(auth->name, PAGE_SIZE, "%s", page); \
885     + snprintf(auth->name, sizeof(auth->name), "%s", page); \
886     if (!strncmp("NULL", auth->name, 4)) \
887     auth->naf_flags &= ~flags; \
888     else \
889     diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
890     index 49b139c..a969ec1 100644
891     --- a/drivers/usb/core/hub.c
892     +++ b/drivers/usb/core/hub.c
893     @@ -488,6 +488,15 @@ resubmit:
894     static inline int
895     hub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt)
896     {
897     + /* Need to clear both directions for control ep */
898     + if (((devinfo >> 11) & USB_ENDPOINT_XFERTYPE_MASK) ==
899     + USB_ENDPOINT_XFER_CONTROL) {
900     + int status = usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
901     + HUB_CLEAR_TT_BUFFER, USB_RT_PORT,
902     + devinfo ^ 0x8000, tt, NULL, 0, 1000);
903     + if (status)
904     + return status;
905     + }
906     return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
907     HUB_CLEAR_TT_BUFFER, USB_RT_PORT, devinfo,
908     tt, NULL, 0, 1000);
909     diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
910     index 6c7945b..29a68f0a 100644
911     --- a/drivers/usb/dwc3/core.h
912     +++ b/drivers/usb/dwc3/core.h
913     @@ -641,8 +641,8 @@ struct dwc3 {
914    
915     struct dwc3_event_type {
916     u32 is_devspec:1;
917     - u32 type:6;
918     - u32 reserved8_31:25;
919     + u32 type:7;
920     + u32 reserved8_31:24;
921     } __packed;
922    
923     #define DWC3_DEPEVT_XFERCOMPLETE 0x01
924     diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
925     index f62629b..6d6fb88 100644
926     --- a/drivers/usb/dwc3/gadget.c
927     +++ b/drivers/usb/dwc3/gadget.c
928     @@ -1393,6 +1393,7 @@ err1:
929     __dwc3_gadget_ep_disable(dwc->eps[0]);
930    
931     err0:
932     + dwc->gadget_driver = NULL;
933     spin_unlock_irqrestore(&dwc->lock, flags);
934    
935     return ret;
936     diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
937     index 84e82dc..8b1c27f 100644
938     --- a/drivers/usb/host/xhci-pci.c
939     +++ b/drivers/usb/host/xhci-pci.c
940     @@ -89,7 +89,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
941     xhci->quirks |= XHCI_AMD_PLL_FIX;
942     if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
943     pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI) {
944     - xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
945     xhci->quirks |= XHCI_EP_LIMIT_QUIRK;
946     xhci->limit_active_eps = 64;
947     xhci->quirks |= XHCI_SW_BW_CHECKING;
948     diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
949     index 843b3e8..1770ed5 100644
950     --- a/drivers/usb/host/xhci-ring.c
951     +++ b/drivers/usb/host/xhci-ring.c
952     @@ -434,7 +434,7 @@ static void ring_doorbell_for_active_rings(struct xhci_hcd *xhci,
953    
954     /* A ring has pending URBs if its TD list is not empty */
955     if (!(ep->ep_state & EP_HAS_STREAMS)) {
956     - if (!(list_empty(&ep->ring->td_list)))
957     + if (ep->ring && !(list_empty(&ep->ring->td_list)))
958     xhci_ring_ep_doorbell(xhci, slot_id, ep_index, 0);
959     return;
960     }
961     diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
962     index 0f928b3..8072a93 100644
963     --- a/drivers/usb/host/xhci.c
964     +++ b/drivers/usb/host/xhci.c
965     @@ -1162,9 +1162,6 @@ static int xhci_check_args(struct usb_hcd *hcd, struct usb_device *udev,
966     }
967    
968     xhci = hcd_to_xhci(hcd);
969     - if (xhci->xhc_state & XHCI_STATE_HALTED)
970     - return -ENODEV;
971     -
972     if (check_virt_dev) {
973     if (!udev->slot_id || !xhci->devs[udev->slot_id]) {
974     printk(KERN_DEBUG "xHCI %s called with unaddressed "
975     @@ -1180,6 +1177,9 @@ static int xhci_check_args(struct usb_hcd *hcd, struct usb_device *udev,
976     }
977     }
978    
979     + if (xhci->xhc_state & XHCI_STATE_HALTED)
980     + return -ENODEV;
981     +
982     return 1;
983     }
984    
985     @@ -4194,6 +4194,13 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
986    
987     get_quirks(dev, xhci);
988    
989     + /* In xhci controllers which follow xhci 1.0 spec gives a spurious
990     + * success event after a short transfer. This quirk will ignore such
991     + * spurious event.
992     + */
993     + if (xhci->hci_version > 0x96)
994     + xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
995     +
996     /* Make sure the HC is halted. */
997     retval = xhci_halt(xhci);
998     if (retval)
999     diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
1000     index dd573ab..7af163d 100644
1001     --- a/drivers/usb/misc/sisusbvga/sisusb.c
1002     +++ b/drivers/usb/misc/sisusbvga/sisusb.c
1003     @@ -3247,6 +3247,7 @@ static const struct usb_device_id sisusb_table[] = {
1004     { USB_DEVICE(0x0711, 0x0903) },
1005     { USB_DEVICE(0x0711, 0x0918) },
1006     { USB_DEVICE(0x0711, 0x0920) },
1007     + { USB_DEVICE(0x0711, 0x0950) },
1008     { USB_DEVICE(0x182d, 0x021c) },
1009     { USB_DEVICE(0x182d, 0x0269) },
1010     { }
1011     diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1012     index f8a9cd7..3e4c27d 100644
1013     --- a/drivers/usb/serial/ftdi_sio.c
1014     +++ b/drivers/usb/serial/ftdi_sio.c
1015     @@ -745,9 +745,34 @@ static struct usb_device_id id_table_combined [] = {
1016     { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID),
1017     .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
1018     { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) },
1019     - { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) },
1020     - { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_CT29B_PID) },
1021     - { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_RTS01_PID) },
1022     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S03_PID) },
1023     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_59_PID) },
1024     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57A_PID) },
1025     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57B_PID) },
1026     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29A_PID) },
1027     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29B_PID) },
1028     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29F_PID) },
1029     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_62B_PID) },
1030     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S01_PID) },
1031     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_63_PID) },
1032     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29C_PID) },
1033     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_81B_PID) },
1034     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_82B_PID) },
1035     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K5D_PID) },
1036     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K4Y_PID) },
1037     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K5G_PID) },
1038     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S05_PID) },
1039     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_60_PID) },
1040     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_61_PID) },
1041     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_62_PID) },
1042     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_63B_PID) },
1043     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_64_PID) },
1044     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_65_PID) },
1045     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_92_PID) },
1046     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_92D_PID) },
1047     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_W5R_PID) },
1048     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_A5R_PID) },
1049     + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_PW1_PID) },
1050     { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) },
1051     { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) },
1052     { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) },
1053     diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
1054     index 6dd7925..1b8af46 100644
1055     --- a/drivers/usb/serial/ftdi_sio_ids.h
1056     +++ b/drivers/usb/serial/ftdi_sio_ids.h
1057     @@ -815,11 +815,35 @@
1058     /*
1059     * RT Systems programming cables for various ham radios
1060     */
1061     -#define RTSYSTEMS_VID 0x2100 /* Vendor ID */
1062     -#define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */
1063     -#define RTSYSTEMS_CT29B_PID 0x9e54 /* CT29B Radio Cable */
1064     -#define RTSYSTEMS_RTS01_PID 0x9e57 /* USB-RTS01 Radio Cable */
1065     -
1066     +#define RTSYSTEMS_VID 0x2100 /* Vendor ID */
1067     +#define RTSYSTEMS_USB_S03_PID 0x9001 /* RTS-03 USB to Serial Adapter */
1068     +#define RTSYSTEMS_USB_59_PID 0x9e50 /* USB-59 USB to 8 pin plug */
1069     +#define RTSYSTEMS_USB_57A_PID 0x9e51 /* USB-57A USB to 4pin 3.5mm plug */
1070     +#define RTSYSTEMS_USB_57B_PID 0x9e52 /* USB-57B USB to extended 4pin 3.5mm plug */
1071     +#define RTSYSTEMS_USB_29A_PID 0x9e53 /* USB-29A USB to 3.5mm stereo plug */
1072     +#define RTSYSTEMS_USB_29B_PID 0x9e54 /* USB-29B USB to 6 pin mini din */
1073     +#define RTSYSTEMS_USB_29F_PID 0x9e55 /* USB-29F USB to 6 pin modular plug */
1074     +#define RTSYSTEMS_USB_62B_PID 0x9e56 /* USB-62B USB to 8 pin mini din plug*/
1075     +#define RTSYSTEMS_USB_S01_PID 0x9e57 /* USB-RTS01 USB to 3.5 mm stereo plug*/
1076     +#define RTSYSTEMS_USB_63_PID 0x9e58 /* USB-63 USB to 9 pin female*/
1077     +#define RTSYSTEMS_USB_29C_PID 0x9e59 /* USB-29C USB to 4 pin modular plug*/
1078     +#define RTSYSTEMS_USB_81B_PID 0x9e5A /* USB-81 USB to 8 pin mini din plug*/
1079     +#define RTSYSTEMS_USB_82B_PID 0x9e5B /* USB-82 USB to 2.5 mm stereo plug*/
1080     +#define RTSYSTEMS_USB_K5D_PID 0x9e5C /* USB-K5D USB to 8 pin modular plug*/
1081     +#define RTSYSTEMS_USB_K4Y_PID 0x9e5D /* USB-K4Y USB to 2.5/3.5 mm plugs*/
1082     +#define RTSYSTEMS_USB_K5G_PID 0x9e5E /* USB-K5G USB to 8 pin modular plug*/
1083     +#define RTSYSTEMS_USB_S05_PID 0x9e5F /* USB-RTS05 USB to 2.5 mm stereo plug*/
1084     +#define RTSYSTEMS_USB_60_PID 0x9e60 /* USB-60 USB to 6 pin din*/
1085     +#define RTSYSTEMS_USB_61_PID 0x9e61 /* USB-61 USB to 6 pin mini din*/
1086     +#define RTSYSTEMS_USB_62_PID 0x9e62 /* USB-62 USB to 8 pin mini din*/
1087     +#define RTSYSTEMS_USB_63B_PID 0x9e63 /* USB-63 USB to 9 pin female*/
1088     +#define RTSYSTEMS_USB_64_PID 0x9e64 /* USB-64 USB to 9 pin male*/
1089     +#define RTSYSTEMS_USB_65_PID 0x9e65 /* USB-65 USB to 9 pin female null modem*/
1090     +#define RTSYSTEMS_USB_92_PID 0x9e66 /* USB-92 USB to 12 pin plug*/
1091     +#define RTSYSTEMS_USB_92D_PID 0x9e67 /* USB-92D USB to 12 pin plug data*/
1092     +#define RTSYSTEMS_USB_W5R_PID 0x9e68 /* USB-W5R USB to 8 pin modular plug*/
1093     +#define RTSYSTEMS_USB_A5R_PID 0x9e69 /* USB-A5R USB to 8 pin modular plug*/
1094     +#define RTSYSTEMS_USB_PW1_PID 0x9e6A /* USB-PW1 USB to 8 pin modular plug*/
1095    
1096     /*
1097     * Physik Instrumente
1098     diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
1099     index a39a08c..a7492ba 100644
1100     --- a/drivers/usb/serial/ti_usb_3410_5052.c
1101     +++ b/drivers/usb/serial/ti_usb_3410_5052.c
1102     @@ -390,7 +390,7 @@ static int ti_startup(struct usb_serial *serial)
1103     usb_set_serial_data(serial, tdev);
1104    
1105     /* determine device type */
1106     - if (usb_match_id(serial->interface, ti_id_table_3410))
1107     + if (serial->type == &ti_1port_device)
1108     tdev->td_is_3410 = 1;
1109     dbg("%s - device type is %s", __func__,
1110     tdev->td_is_3410 ? "3410" : "5052");
1111     diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
1112     index 8ee632c..cf442e0 100644
1113     --- a/drivers/usb/storage/unusual_devs.h
1114     +++ b/drivers/usb/storage/unusual_devs.h
1115     @@ -657,6 +657,13 @@ UNUSUAL_DEV( 0x054c, 0x016a, 0x0000, 0x9999,
1116     USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1117     US_FL_FIX_INQUIRY ),
1118    
1119     +/* Submitted by Ren Bigcren <bigcren.ren@sonymobile.com> */
1120     +UNUSUAL_DEV( 0x054c, 0x02a5, 0x0100, 0x0100,
1121     + "Sony Corp.",
1122     + "MicroVault Flash Drive",
1123     + USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1124     + US_FL_NO_READ_CAPACITY_16 ),
1125     +
1126     /* floppy reports multiple luns */
1127     UNUSUAL_DEV( 0x055d, 0x2020, 0x0000, 0x0210,
1128     "SAMSUNG",
1129     diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
1130     index 52bfd07..c212de7 100644
1131     --- a/drivers/virtio/virtio_ring.c
1132     +++ b/drivers/virtio/virtio_ring.c
1133     @@ -498,16 +498,18 @@ EXPORT_SYMBOL_GPL(virtqueue_disable_cb);
1134     * virtqueue_enable_cb - restart callbacks after disable_cb.
1135     * @vq: the struct virtqueue we're talking about.
1136     *
1137     - * This re-enables callbacks; it returns "false" if there are pending
1138     - * buffers in the queue, to detect a possible race between the driver
1139     - * checking for more work, and enabling callbacks.
1140     + * This re-enables callbacks; it returns current queue state
1141     + * in an opaque unsigned value. This value should be later tested by
1142     + * virtqueue_poll, to detect a possible race between the driver checking for
1143     + * more work, and enabling callbacks.
1144     *
1145     * Caller must ensure we don't call this with other virtqueue
1146     * operations at the same time (except where noted).
1147     */
1148     -bool virtqueue_enable_cb(struct virtqueue *_vq)
1149     +unsigned virtqueue_enable_cb_prepare(struct virtqueue *_vq)
1150     {
1151     struct vring_virtqueue *vq = to_vvq(_vq);
1152     + u16 last_used_idx;
1153    
1154     START_USE(vq);
1155    
1156     @@ -517,15 +519,45 @@ bool virtqueue_enable_cb(struct virtqueue *_vq)
1157     * either clear the flags bit or point the event index at the next
1158     * entry. Always do both to keep code simple. */
1159     vq->vring.avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT;
1160     - vring_used_event(&vq->vring) = vq->last_used_idx;
1161     + vring_used_event(&vq->vring) = last_used_idx = vq->last_used_idx;
1162     + END_USE(vq);
1163     + return last_used_idx;
1164     +}
1165     +EXPORT_SYMBOL_GPL(virtqueue_enable_cb_prepare);
1166     +
1167     +/**
1168     + * virtqueue_poll - query pending used buffers
1169     + * @vq: the struct virtqueue we're talking about.
1170     + * @last_used_idx: virtqueue state (from call to virtqueue_enable_cb_prepare).
1171     + *
1172     + * Returns "true" if there are pending used buffers in the queue.
1173     + *
1174     + * This does not need to be serialized.
1175     + */
1176     +bool virtqueue_poll(struct virtqueue *_vq, unsigned last_used_idx)
1177     +{
1178     + struct vring_virtqueue *vq = to_vvq(_vq);
1179     +
1180     virtio_mb(vq);
1181     - if (unlikely(more_used(vq))) {
1182     - END_USE(vq);
1183     - return false;
1184     - }
1185     + return (u16)last_used_idx != vq->vring.used->idx;
1186     +}
1187     +EXPORT_SYMBOL_GPL(virtqueue_poll);
1188    
1189     - END_USE(vq);
1190     - return true;
1191     +/**
1192     + * virtqueue_enable_cb - restart callbacks after disable_cb.
1193     + * @vq: the struct virtqueue we're talking about.
1194     + *
1195     + * This re-enables callbacks; it returns "false" if there are pending
1196     + * buffers in the queue, to detect a possible race between the driver
1197     + * checking for more work, and enabling callbacks.
1198     + *
1199     + * Caller must ensure we don't call this with other virtqueue
1200     + * operations at the same time (except where noted).
1201     + */
1202     +bool virtqueue_enable_cb(struct virtqueue *_vq)
1203     +{
1204     + unsigned last_used_idx = virtqueue_enable_cb_prepare(_vq);
1205     + return !virtqueue_poll(_vq, last_used_idx);
1206     }
1207     EXPORT_SYMBOL_GPL(virtqueue_enable_cb);
1208    
1209     diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c
1210     index b2db77e..82b27d4 100644
1211     --- a/drivers/xen/evtchn.c
1212     +++ b/drivers/xen/evtchn.c
1213     @@ -377,18 +377,12 @@ static long evtchn_ioctl(struct file *file,
1214     if (unbind.port >= NR_EVENT_CHANNELS)
1215     break;
1216    
1217     - spin_lock_irq(&port_user_lock);
1218     -
1219     rc = -ENOTCONN;
1220     - if (get_port_user(unbind.port) != u) {
1221     - spin_unlock_irq(&port_user_lock);
1222     + if (get_port_user(unbind.port) != u)
1223     break;
1224     - }
1225    
1226     disable_irq(irq_from_evtchn(unbind.port));
1227    
1228     - spin_unlock_irq(&port_user_lock);
1229     -
1230     evtchn_unbind_from_user(u, unbind.port);
1231    
1232     rc = 0;
1233     @@ -488,26 +482,15 @@ static int evtchn_release(struct inode *inode, struct file *filp)
1234     int i;
1235     struct per_user_data *u = filp->private_data;
1236    
1237     - spin_lock_irq(&port_user_lock);
1238     -
1239     - free_page((unsigned long)u->ring);
1240     -
1241     for (i = 0; i < NR_EVENT_CHANNELS; i++) {
1242     if (get_port_user(i) != u)
1243     continue;
1244    
1245     disable_irq(irq_from_evtchn(i));
1246     - }
1247     -
1248     - spin_unlock_irq(&port_user_lock);
1249     -
1250     - for (i = 0; i < NR_EVENT_CHANNELS; i++) {
1251     - if (get_port_user(i) != u)
1252     - continue;
1253     -
1254     evtchn_unbind_from_user(get_port_user(i), i);
1255     }
1256    
1257     + free_page((unsigned long)u->ring);
1258     kfree(u->name);
1259     kfree(u);
1260    
1261     diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
1262     index fef1f21..c4f0a99 100644
1263     --- a/fs/btrfs/extent-tree.c
1264     +++ b/fs/btrfs/extent-tree.c
1265     @@ -6846,6 +6846,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
1266     int err = 0;
1267     int ret;
1268     int level;
1269     + bool root_dropped = false;
1270    
1271     path = btrfs_alloc_path();
1272     if (!path) {
1273     @@ -6903,6 +6904,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
1274     while (1) {
1275     btrfs_tree_lock(path->nodes[level]);
1276     btrfs_set_lock_blocking(path->nodes[level]);
1277     + path->locks[level] = BTRFS_WRITE_LOCK_BLOCKING;
1278    
1279     ret = btrfs_lookup_extent_info(trans, root,
1280     path->nodes[level]->start,
1281     @@ -6919,6 +6921,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
1282     break;
1283    
1284     btrfs_tree_unlock(path->nodes[level]);
1285     + path->locks[level] = 0;
1286     WARN_ON(wc->refs[level] != 1);
1287     level--;
1288     }
1289     @@ -7014,12 +7017,22 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
1290     free_extent_buffer(root->commit_root);
1291     kfree(root);
1292     }
1293     + root_dropped = true;
1294     out_end_trans:
1295     btrfs_end_transaction_throttle(trans, tree_root);
1296     out_free:
1297     kfree(wc);
1298     btrfs_free_path(path);
1299     out:
1300     + /*
1301     + * So if we need to stop dropping the snapshot for whatever reason we
1302     + * need to make sure to add it back to the dead root list so that we
1303     + * keep trying to do the work later. This also cleans up roots if we
1304     + * don't have it in the radix (like when we recover after a power fail
1305     + * or unmount) so we don't leak memory.
1306     + */
1307     + if (root_dropped == false)
1308     + btrfs_add_dead_root(root);
1309     if (err)
1310     btrfs_std_error(root->fs_info, err);
1311     return err;
1312     diff --git a/fs/super.c b/fs/super.c
1313     index cf00177..3c520a5 100644
1314     --- a/fs/super.c
1315     +++ b/fs/super.c
1316     @@ -298,19 +298,19 @@ EXPORT_SYMBOL(deactivate_super);
1317     * and want to turn it into a full-blown active reference. grab_super()
1318     * is called with sb_lock held and drops it. Returns 1 in case of
1319     * success, 0 if we had failed (superblock contents was already dead or
1320     - * dying when grab_super() had been called).
1321     + * dying when grab_super() had been called). Note that this is only
1322     + * called for superblocks not in rundown mode (== ones still on ->fs_supers
1323     + * of their type), so increment of ->s_count is OK here.
1324     */
1325     static int grab_super(struct super_block *s) __releases(sb_lock)
1326     {
1327     - if (atomic_inc_not_zero(&s->s_active)) {
1328     - spin_unlock(&sb_lock);
1329     - return 1;
1330     - }
1331     - /* it's going away */
1332     s->s_count++;
1333     spin_unlock(&sb_lock);
1334     - /* wait for it to die */
1335     down_write(&s->s_umount);
1336     + if ((s->s_flags & MS_BORN) && atomic_inc_not_zero(&s->s_active)) {
1337     + put_super(s);
1338     + return 1;
1339     + }
1340     up_write(&s->s_umount);
1341     put_super(s);
1342     return 0;
1343     @@ -440,11 +440,6 @@ retry:
1344     destroy_super(s);
1345     s = NULL;
1346     }
1347     - down_write(&old->s_umount);
1348     - if (unlikely(!(old->s_flags & MS_BORN))) {
1349     - deactivate_locked_super(old);
1350     - goto retry;
1351     - }
1352     return old;
1353     }
1354     }
1355     @@ -677,10 +672,10 @@ restart:
1356     if (hlist_unhashed(&sb->s_instances))
1357     continue;
1358     if (sb->s_bdev == bdev) {
1359     - if (grab_super(sb)) /* drops sb_lock */
1360     - return sb;
1361     - else
1362     + if (!grab_super(sb))
1363     goto restart;
1364     + up_write(&sb->s_umount);
1365     + return sb;
1366     }
1367     }
1368     spin_unlock(&sb_lock);
1369     diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h
1370     index d500369..1db453e 100644
1371     --- a/include/linux/firewire-cdev.h
1372     +++ b/include/linux/firewire-cdev.h
1373     @@ -215,8 +215,8 @@ struct fw_cdev_event_request2 {
1374     * with the %FW_CDEV_ISO_INTERRUPT bit set, when explicitly requested with
1375     * %FW_CDEV_IOC_FLUSH_ISO, or when there have been so many completed packets
1376     * without the interrupt bit set that the kernel's internal buffer for @header
1377     - * is about to overflow. (In the last case, kernels with ABI version < 5 drop
1378     - * header data up to the next interrupt packet.)
1379     + * is about to overflow. (In the last case, ABI versions < 5 drop header data
1380     + * up to the next interrupt packet.)
1381     *
1382     * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT):
1383     *
1384     diff --git a/include/linux/firewire.h b/include/linux/firewire.h
1385     index cdc9b71..4d259fc 100644
1386     --- a/include/linux/firewire.h
1387     +++ b/include/linux/firewire.h
1388     @@ -409,6 +409,7 @@ struct fw_iso_context {
1389     int type;
1390     int channel;
1391     int speed;
1392     + bool drop_overflow_headers;
1393     size_t header_size;
1394     union {
1395     fw_iso_callback_t sc;
1396     diff --git a/include/linux/virtio.h b/include/linux/virtio.h
1397     index 8efd28a..2b779bf 100644
1398     --- a/include/linux/virtio.h
1399     +++ b/include/linux/virtio.h
1400     @@ -44,6 +44,10 @@ void virtqueue_disable_cb(struct virtqueue *vq);
1401    
1402     bool virtqueue_enable_cb(struct virtqueue *vq);
1403    
1404     +unsigned virtqueue_enable_cb_prepare(struct virtqueue *vq);
1405     +
1406     +bool virtqueue_poll(struct virtqueue *vq, unsigned);
1407     +
1408     bool virtqueue_enable_cb_delayed(struct virtqueue *vq);
1409    
1410     void *virtqueue_detach_unused_buf(struct virtqueue *vq);
1411     diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
1412     index e675182..c9ce09a 100644
1413     --- a/kernel/trace/trace_syscalls.c
1414     +++ b/kernel/trace/trace_syscalls.c
1415     @@ -358,6 +358,9 @@ void ftrace_syscall_exit(void *ignore, struct pt_regs *regs, long ret)
1416     if (!sys_data)
1417     return;
1418    
1419     + local_save_flags(irq_flags);
1420     + pc = preempt_count();
1421     +
1422     event = trace_current_buffer_lock_reserve(&buffer,
1423     sys_data->exit_event->event.type, sizeof(*entry),
1424     irq_flags, pc);
1425     diff --git a/mm/page_alloc.c b/mm/page_alloc.c
1426     index 533ea80..8090542 100644
1427     --- a/mm/page_alloc.c
1428     +++ b/mm/page_alloc.c
1429     @@ -5592,6 +5592,10 @@ __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn)
1430     zone->free_area[order].nr_free--;
1431     __mod_zone_page_state(zone, NR_FREE_PAGES,
1432     - (1UL << order));
1433     +#ifdef CONFIG_HIGHMEM
1434     + if (PageHighMem(page))
1435     + totalhigh_pages -= 1 << order;
1436     +#endif
1437     for (i = 0; i < (1 << order); i++)
1438     SetPageReserved((page+i));
1439     pfn += (1 << order);
1440     diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c
1441     index 4790568..8df4597 100644
1442     --- a/sound/soc/codecs/max98088.c
1443     +++ b/sound/soc/codecs/max98088.c
1444     @@ -1594,7 +1594,7 @@ static int max98088_dai2_digital_mute(struct snd_soc_dai *codec_dai, int mute)
1445    
1446     static void max98088_sync_cache(struct snd_soc_codec *codec)
1447     {
1448     - u16 *reg_cache = codec->reg_cache;
1449     + u8 *reg_cache = codec->reg_cache;
1450     int i;
1451    
1452     if (!codec->cache_sync)
1453     diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
1454     index 96f6f9f..e96c6ed 100644
1455     --- a/sound/soc/codecs/wm8962.c
1456     +++ b/sound/soc/codecs/wm8962.c
1457     @@ -1599,7 +1599,6 @@ static int wm8962_put_hp_sw(struct snd_kcontrol *kcontrol,
1458     struct snd_ctl_elem_value *ucontrol)
1459     {
1460     struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
1461     - u16 *reg_cache = codec->reg_cache;
1462     int ret;
1463    
1464     /* Apply the update (if any) */
1465     @@ -1608,16 +1607,19 @@ static int wm8962_put_hp_sw(struct snd_kcontrol *kcontrol,
1466     return 0;
1467    
1468     /* If the left PGA is enabled hit that VU bit... */
1469     - if (snd_soc_read(codec, WM8962_PWR_MGMT_2) & WM8962_HPOUTL_PGA_ENA)
1470     - return snd_soc_write(codec, WM8962_HPOUTL_VOLUME,
1471     - reg_cache[WM8962_HPOUTL_VOLUME]);
1472     + ret = snd_soc_read(codec, WM8962_PWR_MGMT_2);
1473     + if (ret & WM8962_HPOUTL_PGA_ENA) {
1474     + snd_soc_write(codec, WM8962_HPOUTL_VOLUME,
1475     + snd_soc_read(codec, WM8962_HPOUTL_VOLUME));
1476     + return 1;
1477     + }
1478    
1479     /* ...otherwise the right. The VU is stereo. */
1480     - if (snd_soc_read(codec, WM8962_PWR_MGMT_2) & WM8962_HPOUTR_PGA_ENA)
1481     - return snd_soc_write(codec, WM8962_HPOUTR_VOLUME,
1482     - reg_cache[WM8962_HPOUTR_VOLUME]);
1483     + if (ret & WM8962_HPOUTR_PGA_ENA)
1484     + snd_soc_write(codec, WM8962_HPOUTR_VOLUME,
1485     + snd_soc_read(codec, WM8962_HPOUTR_VOLUME));
1486    
1487     - return 0;
1488     + return 1;
1489     }
1490    
1491     /* The VU bits for the speakers are in a different register to the mute
1492     @@ -3363,7 +3365,6 @@ static int wm8962_probe(struct snd_soc_codec *codec)
1493     int ret;
1494     struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
1495     struct wm8962_pdata *pdata = dev_get_platdata(codec->dev);
1496     - u16 *reg_cache = codec->reg_cache;
1497     int i, trigger, irq_pol;
1498     bool dmicclk, dmicdat;
1499    
1500     @@ -3421,8 +3422,9 @@ static int wm8962_probe(struct snd_soc_codec *codec)
1501    
1502     /* Put the speakers into mono mode? */
1503     if (pdata->spk_mono)
1504     - reg_cache[WM8962_CLASS_D_CONTROL_2]
1505     - |= WM8962_SPK_MONO;
1506     + snd_soc_update_bits(codec, WM8962_CLASS_D_CONTROL_2,
1507     + WM8962_SPK_MONO_MASK, WM8962_SPK_MONO);
1508     +
1509    
1510     /* Micbias setup, detection enable and detection
1511     * threasholds. */