Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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