Magellan Linux

Contents of /trunk/kernel-alx/patches-3.10/0177-3.10.78-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2665 - (show annotations) (download)
Tue Jul 21 16:20:24 2015 UTC (8 years, 9 months ago) by niro
File size: 35540 byte(s)
-linux-3.10.78
1 diff --git a/Makefile b/Makefile
2 index 923ad8a64e3b..cf99a9b53c6f 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 3
7 PATCHLEVEL = 10
8 -SUBLEVEL = 77
9 +SUBLEVEL = 78
10 EXTRAVERSION =
11 NAME = TOSSUG Baby Fish
12
13 diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c
14 index 7e95e1a86510..6763654239a2 100644
15 --- a/arch/arc/kernel/signal.c
16 +++ b/arch/arc/kernel/signal.c
17 @@ -131,6 +131,15 @@ SYSCALL_DEFINE0(rt_sigreturn)
18 /* Don't restart from sigreturn */
19 syscall_wont_restart(regs);
20
21 + /*
22 + * Ensure that sigreturn always returns to user mode (in case the
23 + * regs saved on user stack got fudged between save and sigreturn)
24 + * Otherwise it is easy to panic the kernel with a custom
25 + * signal handler and/or restorer which clobberes the status32/ret
26 + * to return to a bogus location in kernel mode.
27 + */
28 + regs->status32 |= STATUS_U_MASK;
29 +
30 return regs->r0;
31
32 badframe:
33 @@ -234,8 +243,11 @@ setup_rt_frame(int signo, struct k_sigaction *ka, siginfo_t *info,
34
35 /*
36 * handler returns using sigreturn stub provided already by userpsace
37 + * If not, nuke the process right away
38 */
39 - BUG_ON(!(ka->sa.sa_flags & SA_RESTORER));
40 + if(!(ka->sa.sa_flags & SA_RESTORER))
41 + return 1;
42 +
43 regs->blink = (unsigned long)ka->sa.sa_restorer;
44
45 /* User Stack for signal handler will be above the frame just carved */
46 @@ -302,12 +314,12 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
47 struct pt_regs *regs)
48 {
49 sigset_t *oldset = sigmask_to_save();
50 - int ret;
51 + int failed;
52
53 /* Set up the stack frame */
54 - ret = setup_rt_frame(sig, ka, info, oldset, regs);
55 + failed = setup_rt_frame(sig, ka, info, oldset, regs);
56
57 - if (ret)
58 + if (failed)
59 force_sigsegv(sig, current);
60 else
61 signal_delivered(sig, info, ka, regs, 0);
62 diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
63 index 6cab46849cdb..d1e47092d21a 100644
64 --- a/arch/arm/boot/dts/dove.dtsi
65 +++ b/arch/arm/boot/dts/dove.dtsi
66 @@ -75,7 +75,7 @@
67
68 uart2: serial@12200 {
69 compatible = "ns16550a";
70 - reg = <0x12000 0x100>;
71 + reg = <0x12200 0x100>;
72 reg-shift = <2>;
73 interrupts = <9>;
74 clocks = <&core_clk 0>;
75 @@ -84,7 +84,7 @@
76
77 uart3: serial@12300 {
78 compatible = "ns16550a";
79 - reg = <0x12100 0x100>;
80 + reg = <0x12300 0x100>;
81 reg-shift = <2>;
82 interrupts = <10>;
83 clocks = <&core_clk 0>;
84 diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
85 index 7e3f45105f11..dd297099c99d 100644
86 --- a/drivers/block/rbd.c
87 +++ b/drivers/block/rbd.c
88 @@ -2115,6 +2115,11 @@ static bool rbd_img_obj_end_request(struct rbd_obj_request *obj_request)
89 result, xferred);
90 if (!img_request->result)
91 img_request->result = result;
92 + /*
93 + * Need to end I/O on the entire obj_request worth of
94 + * bytes in case of error.
95 + */
96 + xferred = obj_request->length;
97 }
98
99 /* Image object requests don't own their page array */
100 diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
101 index 21ef68934a20..edf8995cb3b3 100644
102 --- a/drivers/hv/channel_mgmt.c
103 +++ b/drivers/hv/channel_mgmt.c
104 @@ -648,7 +648,7 @@ int vmbus_request_offers(void)
105 {
106 struct vmbus_channel_message_header *msg;
107 struct vmbus_channel_msginfo *msginfo;
108 - int ret, t;
109 + int ret;
110
111 msginfo = kmalloc(sizeof(*msginfo) +
112 sizeof(struct vmbus_channel_message_header),
113 @@ -656,8 +656,6 @@ int vmbus_request_offers(void)
114 if (!msginfo)
115 return -ENOMEM;
116
117 - init_completion(&msginfo->waitevent);
118 -
119 msg = (struct vmbus_channel_message_header *)msginfo->msg;
120
121 msg->msgtype = CHANNELMSG_REQUESTOFFERS;
122 @@ -671,14 +669,6 @@ int vmbus_request_offers(void)
123 goto cleanup;
124 }
125
126 - t = wait_for_completion_timeout(&msginfo->waitevent, 5*HZ);
127 - if (t == 0) {
128 - ret = -ETIMEDOUT;
129 - goto cleanup;
130 - }
131 -
132 -
133 -
134 cleanup:
135 kfree(msginfo);
136
137 diff --git a/drivers/mtd/ubi/misc.c b/drivers/mtd/ubi/misc.c
138 index f913d701a5b3..c4b1af07a121 100644
139 --- a/drivers/mtd/ubi/misc.c
140 +++ b/drivers/mtd/ubi/misc.c
141 @@ -74,6 +74,8 @@ int ubi_check_volume(struct ubi_device *ubi, int vol_id)
142 for (i = 0; i < vol->used_ebs; i++) {
143 int size;
144
145 + cond_resched();
146 +
147 if (i == vol->used_ebs - 1)
148 size = vol->last_eb_bytes;
149 else
150 diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
151 index 0a7325361d29..5f57e3d35e26 100644
152 --- a/drivers/scsi/3w-9xxx.c
153 +++ b/drivers/scsi/3w-9xxx.c
154 @@ -149,7 +149,6 @@ static int twa_reset_sequence(TW_Device_Extension *tw_dev, int soft_reset);
155 static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry *sglistarg);
156 static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int request_id);
157 static char *twa_string_lookup(twa_message_type *table, unsigned int aen_code);
158 -static void twa_unmap_scsi_data(TW_Device_Extension *tw_dev, int request_id);
159
160 /* Functions */
161
162 @@ -1352,11 +1351,11 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
163 }
164
165 /* Now complete the io */
166 + scsi_dma_unmap(cmd);
167 + cmd->scsi_done(cmd);
168 tw_dev->state[request_id] = TW_S_COMPLETED;
169 twa_free_request_id(tw_dev, request_id);
170 tw_dev->posted_request_count--;
171 - tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]);
172 - twa_unmap_scsi_data(tw_dev, request_id);
173 }
174
175 /* Check for valid status after each drain */
176 @@ -1414,26 +1413,6 @@ static void twa_load_sgl(TW_Device_Extension *tw_dev, TW_Command_Full *full_comm
177 }
178 } /* End twa_load_sgl() */
179
180 -/* This function will perform a pci-dma mapping for a scatter gather list */
181 -static int twa_map_scsi_sg_data(TW_Device_Extension *tw_dev, int request_id)
182 -{
183 - int use_sg;
184 - struct scsi_cmnd *cmd = tw_dev->srb[request_id];
185 -
186 - use_sg = scsi_dma_map(cmd);
187 - if (!use_sg)
188 - return 0;
189 - else if (use_sg < 0) {
190 - TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1c, "Failed to map scatter gather list");
191 - return 0;
192 - }
193 -
194 - cmd->SCp.phase = TW_PHASE_SGLIST;
195 - cmd->SCp.have_data_in = use_sg;
196 -
197 - return use_sg;
198 -} /* End twa_map_scsi_sg_data() */
199 -
200 /* This function will poll for a response interrupt of a request */
201 static int twa_poll_response(TW_Device_Extension *tw_dev, int request_id, int seconds)
202 {
203 @@ -1612,9 +1591,11 @@ static int twa_reset_device_extension(TW_Device_Extension *tw_dev)
204 (tw_dev->state[i] != TW_S_INITIAL) &&
205 (tw_dev->state[i] != TW_S_COMPLETED)) {
206 if (tw_dev->srb[i]) {
207 - tw_dev->srb[i]->result = (DID_RESET << 16);
208 - tw_dev->srb[i]->scsi_done(tw_dev->srb[i]);
209 - twa_unmap_scsi_data(tw_dev, i);
210 + struct scsi_cmnd *cmd = tw_dev->srb[i];
211 +
212 + cmd->result = (DID_RESET << 16);
213 + scsi_dma_unmap(cmd);
214 + cmd->scsi_done(cmd);
215 }
216 }
217 }
218 @@ -1793,21 +1774,18 @@ static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
219 /* Save the scsi command for use by the ISR */
220 tw_dev->srb[request_id] = SCpnt;
221
222 - /* Initialize phase to zero */
223 - SCpnt->SCp.phase = TW_PHASE_INITIAL;
224 -
225 retval = twa_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL);
226 switch (retval) {
227 case SCSI_MLQUEUE_HOST_BUSY:
228 + scsi_dma_unmap(SCpnt);
229 twa_free_request_id(tw_dev, request_id);
230 - twa_unmap_scsi_data(tw_dev, request_id);
231 break;
232 case 1:
233 - tw_dev->state[request_id] = TW_S_COMPLETED;
234 - twa_free_request_id(tw_dev, request_id);
235 - twa_unmap_scsi_data(tw_dev, request_id);
236 SCpnt->result = (DID_ERROR << 16);
237 + scsi_dma_unmap(SCpnt);
238 done(SCpnt);
239 + tw_dev->state[request_id] = TW_S_COMPLETED;
240 + twa_free_request_id(tw_dev, request_id);
241 retval = 0;
242 }
243 out:
244 @@ -1875,8 +1853,8 @@ static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
245 command_packet->sg_list[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]);
246 command_packet->sg_list[0].length = cpu_to_le32(TW_MIN_SGL_LENGTH);
247 } else {
248 - sg_count = twa_map_scsi_sg_data(tw_dev, request_id);
249 - if (sg_count == 0)
250 + sg_count = scsi_dma_map(srb);
251 + if (sg_count < 0)
252 goto out;
253
254 scsi_for_each_sg(srb, sg, sg_count, i) {
255 @@ -1991,15 +1969,6 @@ static char *twa_string_lookup(twa_message_type *table, unsigned int code)
256 return(table[index].text);
257 } /* End twa_string_lookup() */
258
259 -/* This function will perform a pci-dma unmap */
260 -static void twa_unmap_scsi_data(TW_Device_Extension *tw_dev, int request_id)
261 -{
262 - struct scsi_cmnd *cmd = tw_dev->srb[request_id];
263 -
264 - if (cmd->SCp.phase == TW_PHASE_SGLIST)
265 - scsi_dma_unmap(cmd);
266 -} /* End twa_unmap_scsi_data() */
267 -
268 /* This function gets called when a disk is coming on-line */
269 static int twa_slave_configure(struct scsi_device *sdev)
270 {
271 diff --git a/drivers/scsi/3w-9xxx.h b/drivers/scsi/3w-9xxx.h
272 index 040f7214e5b7..0fdc83cfa0e1 100644
273 --- a/drivers/scsi/3w-9xxx.h
274 +++ b/drivers/scsi/3w-9xxx.h
275 @@ -324,11 +324,6 @@ static twa_message_type twa_error_table[] = {
276 #define TW_CURRENT_DRIVER_BUILD 0
277 #define TW_CURRENT_DRIVER_BRANCH 0
278
279 -/* Phase defines */
280 -#define TW_PHASE_INITIAL 0
281 -#define TW_PHASE_SINGLE 1
282 -#define TW_PHASE_SGLIST 2
283 -
284 /* Misc defines */
285 #define TW_9550SX_DRAIN_COMPLETED 0xFFFF
286 #define TW_SECTOR_SIZE 512
287 diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
288 index 4de346017e9f..61702ac00d42 100644
289 --- a/drivers/scsi/3w-sas.c
290 +++ b/drivers/scsi/3w-sas.c
291 @@ -303,26 +303,6 @@ static int twl_post_command_packet(TW_Device_Extension *tw_dev, int request_id)
292 return 0;
293 } /* End twl_post_command_packet() */
294
295 -/* This function will perform a pci-dma mapping for a scatter gather list */
296 -static int twl_map_scsi_sg_data(TW_Device_Extension *tw_dev, int request_id)
297 -{
298 - int use_sg;
299 - struct scsi_cmnd *cmd = tw_dev->srb[request_id];
300 -
301 - use_sg = scsi_dma_map(cmd);
302 - if (!use_sg)
303 - return 0;
304 - else if (use_sg < 0) {
305 - TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1, "Failed to map scatter gather list");
306 - return 0;
307 - }
308 -
309 - cmd->SCp.phase = TW_PHASE_SGLIST;
310 - cmd->SCp.have_data_in = use_sg;
311 -
312 - return use_sg;
313 -} /* End twl_map_scsi_sg_data() */
314 -
315 /* This function hands scsi cdb's to the firmware */
316 static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry_ISO *sglistarg)
317 {
318 @@ -370,8 +350,8 @@ static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
319 if (!sglistarg) {
320 /* Map sglist from scsi layer to cmd packet */
321 if (scsi_sg_count(srb)) {
322 - sg_count = twl_map_scsi_sg_data(tw_dev, request_id);
323 - if (sg_count == 0)
324 + sg_count = scsi_dma_map(srb);
325 + if (sg_count <= 0)
326 goto out;
327
328 scsi_for_each_sg(srb, sg, sg_count, i) {
329 @@ -1116,15 +1096,6 @@ out:
330 return retval;
331 } /* End twl_initialize_device_extension() */
332
333 -/* This function will perform a pci-dma unmap */
334 -static void twl_unmap_scsi_data(TW_Device_Extension *tw_dev, int request_id)
335 -{
336 - struct scsi_cmnd *cmd = tw_dev->srb[request_id];
337 -
338 - if (cmd->SCp.phase == TW_PHASE_SGLIST)
339 - scsi_dma_unmap(cmd);
340 -} /* End twl_unmap_scsi_data() */
341 -
342 /* This function will handle attention interrupts */
343 static int twl_handle_attention_interrupt(TW_Device_Extension *tw_dev)
344 {
345 @@ -1265,11 +1236,11 @@ static irqreturn_t twl_interrupt(int irq, void *dev_instance)
346 }
347
348 /* Now complete the io */
349 + scsi_dma_unmap(cmd);
350 + cmd->scsi_done(cmd);
351 tw_dev->state[request_id] = TW_S_COMPLETED;
352 twl_free_request_id(tw_dev, request_id);
353 tw_dev->posted_request_count--;
354 - tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]);
355 - twl_unmap_scsi_data(tw_dev, request_id);
356 }
357
358 /* Check for another response interrupt */
359 @@ -1414,10 +1385,12 @@ static int twl_reset_device_extension(TW_Device_Extension *tw_dev, int ioctl_res
360 if ((tw_dev->state[i] != TW_S_FINISHED) &&
361 (tw_dev->state[i] != TW_S_INITIAL) &&
362 (tw_dev->state[i] != TW_S_COMPLETED)) {
363 - if (tw_dev->srb[i]) {
364 - tw_dev->srb[i]->result = (DID_RESET << 16);
365 - tw_dev->srb[i]->scsi_done(tw_dev->srb[i]);
366 - twl_unmap_scsi_data(tw_dev, i);
367 + struct scsi_cmnd *cmd = tw_dev->srb[i];
368 +
369 + if (cmd) {
370 + cmd->result = (DID_RESET << 16);
371 + scsi_dma_unmap(cmd);
372 + cmd->scsi_done(cmd);
373 }
374 }
375 }
376 @@ -1521,9 +1494,6 @@ static int twl_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
377 /* Save the scsi command for use by the ISR */
378 tw_dev->srb[request_id] = SCpnt;
379
380 - /* Initialize phase to zero */
381 - SCpnt->SCp.phase = TW_PHASE_INITIAL;
382 -
383 retval = twl_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL);
384 if (retval) {
385 tw_dev->state[request_id] = TW_S_COMPLETED;
386 diff --git a/drivers/scsi/3w-sas.h b/drivers/scsi/3w-sas.h
387 index d474892701d4..fec6449c7595 100644
388 --- a/drivers/scsi/3w-sas.h
389 +++ b/drivers/scsi/3w-sas.h
390 @@ -103,10 +103,6 @@ static char *twl_aen_severity_table[] =
391 #define TW_CURRENT_DRIVER_BUILD 0
392 #define TW_CURRENT_DRIVER_BRANCH 0
393
394 -/* Phase defines */
395 -#define TW_PHASE_INITIAL 0
396 -#define TW_PHASE_SGLIST 2
397 -
398 /* Misc defines */
399 #define TW_SECTOR_SIZE 512
400 #define TW_MAX_UNITS 32
401 diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
402 index 430ee3774c3b..8843ad783b41 100644
403 --- a/drivers/scsi/3w-xxxx.c
404 +++ b/drivers/scsi/3w-xxxx.c
405 @@ -1283,32 +1283,6 @@ static int tw_initialize_device_extension(TW_Device_Extension *tw_dev)
406 return 0;
407 } /* End tw_initialize_device_extension() */
408
409 -static int tw_map_scsi_sg_data(struct pci_dev *pdev, struct scsi_cmnd *cmd)
410 -{
411 - int use_sg;
412 -
413 - dprintk(KERN_WARNING "3w-xxxx: tw_map_scsi_sg_data()\n");
414 -
415 - use_sg = scsi_dma_map(cmd);
416 - if (use_sg < 0) {
417 - printk(KERN_WARNING "3w-xxxx: tw_map_scsi_sg_data(): pci_map_sg() failed.\n");
418 - return 0;
419 - }
420 -
421 - cmd->SCp.phase = TW_PHASE_SGLIST;
422 - cmd->SCp.have_data_in = use_sg;
423 -
424 - return use_sg;
425 -} /* End tw_map_scsi_sg_data() */
426 -
427 -static void tw_unmap_scsi_data(struct pci_dev *pdev, struct scsi_cmnd *cmd)
428 -{
429 - dprintk(KERN_WARNING "3w-xxxx: tw_unmap_scsi_data()\n");
430 -
431 - if (cmd->SCp.phase == TW_PHASE_SGLIST)
432 - scsi_dma_unmap(cmd);
433 -} /* End tw_unmap_scsi_data() */
434 -
435 /* This function will reset a device extension */
436 static int tw_reset_device_extension(TW_Device_Extension *tw_dev)
437 {
438 @@ -1331,8 +1305,8 @@ static int tw_reset_device_extension(TW_Device_Extension *tw_dev)
439 srb = tw_dev->srb[i];
440 if (srb != NULL) {
441 srb->result = (DID_RESET << 16);
442 - tw_dev->srb[i]->scsi_done(tw_dev->srb[i]);
443 - tw_unmap_scsi_data(tw_dev->tw_pci_dev, tw_dev->srb[i]);
444 + scsi_dma_unmap(srb);
445 + srb->scsi_done(srb);
446 }
447 }
448 }
449 @@ -1779,8 +1753,8 @@ static int tw_scsiop_read_write(TW_Device_Extension *tw_dev, int request_id)
450 command_packet->byte8.io.lba = lba;
451 command_packet->byte6.block_count = num_sectors;
452
453 - use_sg = tw_map_scsi_sg_data(tw_dev->tw_pci_dev, tw_dev->srb[request_id]);
454 - if (!use_sg)
455 + use_sg = scsi_dma_map(srb);
456 + if (use_sg <= 0)
457 return 1;
458
459 scsi_for_each_sg(tw_dev->srb[request_id], sg, use_sg, i) {
460 @@ -1967,9 +1941,6 @@ static int tw_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_c
461 /* Save the scsi command for use by the ISR */
462 tw_dev->srb[request_id] = SCpnt;
463
464 - /* Initialize phase to zero */
465 - SCpnt->SCp.phase = TW_PHASE_INITIAL;
466 -
467 switch (*command) {
468 case READ_10:
469 case READ_6:
470 @@ -2196,12 +2167,11 @@ static irqreturn_t tw_interrupt(int irq, void *dev_instance)
471
472 /* Now complete the io */
473 if ((error != TW_ISR_DONT_COMPLETE)) {
474 + scsi_dma_unmap(tw_dev->srb[request_id]);
475 + tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]);
476 tw_dev->state[request_id] = TW_S_COMPLETED;
477 tw_state_request_finish(tw_dev, request_id);
478 tw_dev->posted_request_count--;
479 - tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]);
480 -
481 - tw_unmap_scsi_data(tw_dev->tw_pci_dev, tw_dev->srb[request_id]);
482 }
483 }
484
485 diff --git a/drivers/scsi/3w-xxxx.h b/drivers/scsi/3w-xxxx.h
486 index 49dcf03c631a..1d31858766ce 100644
487 --- a/drivers/scsi/3w-xxxx.h
488 +++ b/drivers/scsi/3w-xxxx.h
489 @@ -195,11 +195,6 @@ static unsigned char tw_sense_table[][4] =
490 #define TW_AEN_SMART_FAIL 0x000F
491 #define TW_AEN_SBUF_FAIL 0x0024
492
493 -/* Phase defines */
494 -#define TW_PHASE_INITIAL 0
495 -#define TW_PHASE_SINGLE 1
496 -#define TW_PHASE_SGLIST 2
497 -
498 /* Misc defines */
499 #define TW_ALIGNMENT_6000 64 /* 64 bytes */
500 #define TW_ALIGNMENT_7000 4 /* 4 bytes */
501 diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
502 index c54df3948e20..4d0a87b93b96 100644
503 --- a/drivers/staging/panel/panel.c
504 +++ b/drivers/staging/panel/panel.c
505 @@ -275,11 +275,11 @@ static unsigned char lcd_bits[LCD_PORTS][LCD_BITS][BIT_STATES];
506 * LCD types
507 */
508 #define LCD_TYPE_NONE 0
509 -#define LCD_TYPE_OLD 1
510 -#define LCD_TYPE_KS0074 2
511 -#define LCD_TYPE_HANTRONIX 3
512 -#define LCD_TYPE_NEXCOM 4
513 -#define LCD_TYPE_CUSTOM 5
514 +#define LCD_TYPE_CUSTOM 1
515 +#define LCD_TYPE_OLD 2
516 +#define LCD_TYPE_KS0074 3
517 +#define LCD_TYPE_HANTRONIX 4
518 +#define LCD_TYPE_NEXCOM 5
519
520 /*
521 * keypad types
522 @@ -457,8 +457,7 @@ MODULE_PARM_DESC(keypad_enabled, "Deprecated option, use keypad_type instead");
523 static int lcd_type = -1;
524 module_param(lcd_type, int, 0000);
525 MODULE_PARM_DESC(lcd_type,
526 - "LCD type: 0=none, 1=old //, 2=serial ks0074, "
527 - "3=hantronix //, 4=nexcom //, 5=compiled-in");
528 + "LCD type: 0=none, 1=compiled-in, 2=old, 3=serial ks0074, 4=hantronix, 5=nexcom");
529
530 static int lcd_proto = -1;
531 module_param(lcd_proto, int, 0000);
532 diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
533 index 39c7ea4cb14f..2225f83f4c04 100644
534 --- a/drivers/tty/serial/of_serial.c
535 +++ b/drivers/tty/serial/of_serial.c
536 @@ -262,7 +262,6 @@ static struct of_device_id of_platform_serial_table[] = {
537 { .compatible = "ibm,qpace-nwp-serial",
538 .data = (void *)PORT_NWPSERIAL, },
539 #endif
540 - { .type = "serial", .data = (void *)PORT_UNKNOWN, },
541 { /* end of list */ },
542 };
543
544 diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c
545 index bf7a56b6d48a..a0dfdbddbf08 100644
546 --- a/drivers/usb/gadget/printer.c
547 +++ b/drivers/usb/gadget/printer.c
548 @@ -975,6 +975,15 @@ unknown:
549 break;
550 }
551 /* host either stalls (value < 0) or reports success */
552 + if (value >= 0) {
553 + req->length = value;
554 + req->zero = value < wLength;
555 + value = usb_ep_queue(cdev->gadget->ep0, req, GFP_ATOMIC);
556 + if (value < 0) {
557 + ERROR(dev, "%s:%d Error!\n", __func__, __LINE__);
558 + req->status = 0;
559 + }
560 + }
561 return value;
562 }
563
564 diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
565 index 0f401dbfaf07..b5c4f4d81a38 100644
566 --- a/drivers/usb/host/oxu210hp-hcd.c
567 +++ b/drivers/usb/host/oxu210hp-hcd.c
568 @@ -2497,11 +2497,12 @@ static irqreturn_t oxu210_hcd_irq(struct usb_hcd *hcd)
569 || oxu->reset_done[i] != 0)
570 continue;
571
572 - /* start 20 msec resume signaling from this port,
573 - * and make khubd collect PORT_STAT_C_SUSPEND to
574 + /* start USB_RESUME_TIMEOUT resume signaling from this
575 + * port, and make hub_wq collect PORT_STAT_C_SUSPEND to
576 * stop that signaling.
577 */
578 - oxu->reset_done[i] = jiffies + msecs_to_jiffies(20);
579 + oxu->reset_done[i] = jiffies +
580 + msecs_to_jiffies(USB_RESUME_TIMEOUT);
581 oxu_dbg(oxu, "port %d remote wakeup\n", i + 1);
582 mod_timer(&hcd->rh_timer, oxu->reset_done[i]);
583 }
584 diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c
585 index e6941e622d31..1fefeb7d14db 100644
586 --- a/fs/ext4/extents_status.c
587 +++ b/fs/ext4/extents_status.c
588 @@ -655,6 +655,14 @@ int ext4_es_insert_extent(struct inode *inode, ext4_lblk_t lblk,
589
590 BUG_ON(end < lblk);
591
592 + if ((status & EXTENT_STATUS_DELAYED) &&
593 + (status & EXTENT_STATUS_WRITTEN)) {
594 + ext4_warning(inode->i_sb, "Inserting extent [%u/%u] as "
595 + " delayed and written which can potentially "
596 + " cause data loss.\n", lblk, len);
597 + WARN_ON(1);
598 + }
599 +
600 newes.es_lblk = lblk;
601 newes.es_len = len;
602 ext4_es_store_pblock(&newes, pblk);
603 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
604 index e48bd5a1814b..9e3d8dd6c40a 100644
605 --- a/fs/ext4/inode.c
606 +++ b/fs/ext4/inode.c
607 @@ -626,6 +626,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
608 status = map->m_flags & EXT4_MAP_UNWRITTEN ?
609 EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN;
610 if (!(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) &&
611 + !(status & EXTENT_STATUS_WRITTEN) &&
612 ext4_find_delalloc_range(inode, map->m_lblk,
613 map->m_lblk + map->m_len - 1))
614 status |= EXTENT_STATUS_DELAYED;
615 @@ -736,6 +737,7 @@ found:
616 status = map->m_flags & EXT4_MAP_UNWRITTEN ?
617 EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN;
618 if (!(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) &&
619 + !(status & EXTENT_STATUS_WRITTEN) &&
620 ext4_find_delalloc_range(inode, map->m_lblk,
621 map->m_lblk + map->m_len - 1))
622 status |= EXTENT_STATUS_DELAYED;
623 diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
624 index dfb42ca6d043..8898cdeb42a4 100644
625 --- a/include/sound/emu10k1.h
626 +++ b/include/sound/emu10k1.h
627 @@ -41,7 +41,8 @@
628
629 #define EMUPAGESIZE 4096
630 #define MAXREQVOICES 8
631 -#define MAXPAGES 8192
632 +#define MAXPAGES0 4096 /* 32 bit mode */
633 +#define MAXPAGES1 8192 /* 31 bit mode */
634 #define RESERVED 0
635 #define NUM_MIDI 16
636 #define NUM_G 64 /* use all channels */
637 @@ -50,8 +51,7 @@
638
639 /* FIXME? - according to the OSS driver the EMU10K1 needs a 29 bit DMA mask */
640 #define EMU10K1_DMA_MASK 0x7fffffffUL /* 31bit */
641 -#define AUDIGY_DMA_MASK 0x7fffffffUL /* 31bit FIXME - 32 should work? */
642 - /* See ALSA bug #1276 - rlrevell */
643 +#define AUDIGY_DMA_MASK 0xffffffffUL /* 32bit mode */
644
645 #define TMEMSIZE 256*1024
646 #define TMEMSIZEREG 4
647 @@ -468,8 +468,11 @@
648
649 #define MAPB 0x0d /* Cache map B */
650
651 -#define MAP_PTE_MASK 0xffffe000 /* The 19 MSBs of the PTE indexed by the PTI */
652 -#define MAP_PTI_MASK 0x00001fff /* The 13 bit index to one of the 8192 PTE dwords */
653 +#define MAP_PTE_MASK0 0xfffff000 /* The 20 MSBs of the PTE indexed by the PTI */
654 +#define MAP_PTI_MASK0 0x00000fff /* The 12 bit index to one of the 4096 PTE dwords */
655 +
656 +#define MAP_PTE_MASK1 0xffffe000 /* The 19 MSBs of the PTE indexed by the PTI */
657 +#define MAP_PTI_MASK1 0x00001fff /* The 13 bit index to one of the 8192 PTE dwords */
658
659 /* 0x0e, 0x0f: Not used */
660
661 @@ -1706,6 +1709,7 @@ struct snd_emu10k1 {
662 unsigned short model; /* subsystem id */
663 unsigned int card_type; /* EMU10K1_CARD_* */
664 unsigned int ecard_ctrl; /* ecard control bits */
665 + unsigned int address_mode; /* address mode */
666 unsigned long dma_mask; /* PCI DMA mask */
667 unsigned int delay_pcm_irq; /* in samples */
668 int max_cache_pages; /* max memory size / PAGE_SIZE */
669 diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
670 index 698f3a2ac5ae..459b957104a8 100644
671 --- a/net/ipv4/ping.c
672 +++ b/net/ipv4/ping.c
673 @@ -139,6 +139,7 @@ static void ping_v4_unhash(struct sock *sk)
674 if (sk_hashed(sk)) {
675 write_lock_bh(&ping_table.lock);
676 hlist_nulls_del(&sk->sk_nulls_node);
677 + sk_nulls_node_init(&sk->sk_nulls_node);
678 sock_put(sk);
679 isk->inet_num = 0;
680 isk->inet_sport = 0;
681 diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
682 index 8c5010f7889c..70e6fe186d34 100644
683 --- a/sound/pci/emu10k1/emu10k1.c
684 +++ b/sound/pci/emu10k1/emu10k1.c
685 @@ -181,8 +181,10 @@ static int snd_card_emu10k1_probe(struct pci_dev *pci,
686 }
687 #endif
688
689 - strcpy(card->driver, emu->card_capabilities->driver);
690 - strcpy(card->shortname, emu->card_capabilities->name);
691 + strlcpy(card->driver, emu->card_capabilities->driver,
692 + sizeof(card->driver));
693 + strlcpy(card->shortname, emu->card_capabilities->name,
694 + sizeof(card->shortname));
695 snprintf(card->longname, sizeof(card->longname),
696 "%s (rev.%d, serial:0x%x) at 0x%lx, irq %i",
697 card->shortname, emu->revision, emu->serial, emu->port, emu->irq);
698 diff --git a/sound/pci/emu10k1/emu10k1_callback.c b/sound/pci/emu10k1/emu10k1_callback.c
699 index 0a34b5f1c475..f8a6549f00e5 100644
700 --- a/sound/pci/emu10k1/emu10k1_callback.c
701 +++ b/sound/pci/emu10k1/emu10k1_callback.c
702 @@ -415,7 +415,7 @@ start_voice(struct snd_emux_voice *vp)
703 snd_emu10k1_ptr_write(hw, Z2, ch, 0);
704
705 /* invalidate maps */
706 - temp = (hw->silent_page.addr << 1) | MAP_PTI_MASK;
707 + temp = (hw->silent_page.addr << hw->address_mode) | (hw->address_mode ? MAP_PTI_MASK1 : MAP_PTI_MASK0);
708 snd_emu10k1_ptr_write(hw, MAPA, ch, temp);
709 snd_emu10k1_ptr_write(hw, MAPB, ch, temp);
710 #if 0
711 @@ -436,7 +436,7 @@ start_voice(struct snd_emux_voice *vp)
712 snd_emu10k1_ptr_write(hw, CDF, ch, sample);
713
714 /* invalidate maps */
715 - temp = ((unsigned int)hw->silent_page.addr << 1) | MAP_PTI_MASK;
716 + temp = ((unsigned int)hw->silent_page.addr << hw_address_mode) | (hw->address_mode ? MAP_PTI_MASK1 : MAP_PTI_MASK0);
717 snd_emu10k1_ptr_write(hw, MAPA, ch, temp);
718 snd_emu10k1_ptr_write(hw, MAPB, ch, temp);
719
720 diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
721 index bdd888ec9a84..a131092572e6 100644
722 --- a/sound/pci/emu10k1/emu10k1_main.c
723 +++ b/sound/pci/emu10k1/emu10k1_main.c
724 @@ -282,7 +282,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
725 snd_emu10k1_ptr_write(emu, TCB, 0, 0); /* taken from original driver */
726 snd_emu10k1_ptr_write(emu, TCBS, 0, 4); /* taken from original driver */
727
728 - silent_page = (emu->silent_page.addr << 1) | MAP_PTI_MASK;
729 + silent_page = (emu->silent_page.addr << emu->address_mode) | (emu->address_mode ? MAP_PTI_MASK1 : MAP_PTI_MASK0);
730 for (ch = 0; ch < NUM_G; ch++) {
731 snd_emu10k1_ptr_write(emu, MAPA, ch, silent_page);
732 snd_emu10k1_ptr_write(emu, MAPB, ch, silent_page);
733 @@ -348,6 +348,11 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
734 outl(reg | A_IOCFG_GPOUT0, emu->port + A_IOCFG);
735 }
736
737 + if (emu->address_mode == 0) {
738 + /* use 16M in 4G */
739 + outl(inl(emu->port + HCFG) | HCFG_EXPANDED_MEM, emu->port + HCFG);
740 + }
741 +
742 return 0;
743 }
744
745 @@ -1411,7 +1416,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
746 *
747 */
748 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x20011102,
749 - .driver = "Audigy2", .name = "SB Audigy 2 ZS Notebook [SB0530]",
750 + .driver = "Audigy2", .name = "Audigy 2 ZS Notebook [SB0530]",
751 .id = "Audigy2",
752 .emu10k2_chip = 1,
753 .ca0108_chip = 1,
754 @@ -1561,7 +1566,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
755 .adc_1361t = 1, /* 24 bit capture instead of 16bit */
756 .ac97_chip = 1} ,
757 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10051102,
758 - .driver = "Audigy2", .name = "SB Audigy 2 Platinum EX [SB0280]",
759 + .driver = "Audigy2", .name = "Audigy 2 Platinum EX [SB0280]",
760 .id = "Audigy2",
761 .emu10k2_chip = 1,
762 .ca0102_chip = 1,
763 @@ -1865,8 +1870,10 @@ int snd_emu10k1_create(struct snd_card *card,
764
765 is_audigy = emu->audigy = c->emu10k2_chip;
766
767 + /* set addressing mode */
768 + emu->address_mode = is_audigy ? 0 : 1;
769 /* set the DMA transfer mask */
770 - emu->dma_mask = is_audigy ? AUDIGY_DMA_MASK : EMU10K1_DMA_MASK;
771 + emu->dma_mask = emu->address_mode ? EMU10K1_DMA_MASK : AUDIGY_DMA_MASK;
772 if (pci_set_dma_mask(pci, emu->dma_mask) < 0 ||
773 pci_set_consistent_dma_mask(pci, emu->dma_mask) < 0) {
774 snd_printk(KERN_ERR "architecture does not support PCI busmaster DMA with mask 0x%lx\n", emu->dma_mask);
775 @@ -1889,7 +1896,7 @@ int snd_emu10k1_create(struct snd_card *card,
776
777 emu->max_cache_pages = max_cache_bytes >> PAGE_SHIFT;
778 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
779 - 32 * 1024, &emu->ptb_pages) < 0) {
780 + (emu->address_mode ? 32 : 16) * 1024, &emu->ptb_pages) < 0) {
781 err = -ENOMEM;
782 goto error;
783 }
784 @@ -1988,8 +1995,8 @@ int snd_emu10k1_create(struct snd_card *card,
785
786 /* Clear silent pages and set up pointers */
787 memset(emu->silent_page.area, 0, PAGE_SIZE);
788 - silent_page = emu->silent_page.addr << 1;
789 - for (idx = 0; idx < MAXPAGES; idx++)
790 + silent_page = emu->silent_page.addr << emu->address_mode;
791 + for (idx = 0; idx < (emu->address_mode ? MAXPAGES1 : MAXPAGES0); idx++)
792 ((u32 *)emu->ptb_pages.area)[idx] = cpu_to_le32(silent_page | idx);
793
794 /* set up voice indices */
795 diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
796 index 5ae1d045bdcb..7581019d7c84 100644
797 --- a/sound/pci/emu10k1/emupcm.c
798 +++ b/sound/pci/emu10k1/emupcm.c
799 @@ -379,7 +379,7 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1 *emu,
800 snd_emu10k1_ptr_write(emu, Z1, voice, 0);
801 snd_emu10k1_ptr_write(emu, Z2, voice, 0);
802 /* invalidate maps */
803 - silent_page = ((unsigned int)emu->silent_page.addr << 1) | MAP_PTI_MASK;
804 + silent_page = ((unsigned int)emu->silent_page.addr << emu->address_mode) | (emu->address_mode ? MAP_PTI_MASK1 : MAP_PTI_MASK0);
805 snd_emu10k1_ptr_write(emu, MAPA, voice, silent_page);
806 snd_emu10k1_ptr_write(emu, MAPB, voice, silent_page);
807 /* modulation envelope */
808 diff --git a/sound/pci/emu10k1/memory.c b/sound/pci/emu10k1/memory.c
809 index ae709c1ab3a8..d514458efe3d 100644
810 --- a/sound/pci/emu10k1/memory.c
811 +++ b/sound/pci/emu10k1/memory.c
812 @@ -34,10 +34,11 @@
813 * aligned pages in others
814 */
815 #define __set_ptb_entry(emu,page,addr) \
816 - (((u32 *)(emu)->ptb_pages.area)[page] = cpu_to_le32(((addr) << 1) | (page)))
817 + (((u32 *)(emu)->ptb_pages.area)[page] = cpu_to_le32(((addr) << (emu->address_mode)) | (page)))
818
819 #define UNIT_PAGES (PAGE_SIZE / EMUPAGESIZE)
820 -#define MAX_ALIGN_PAGES (MAXPAGES / UNIT_PAGES)
821 +#define MAX_ALIGN_PAGES0 (MAXPAGES0 / UNIT_PAGES)
822 +#define MAX_ALIGN_PAGES1 (MAXPAGES1 / UNIT_PAGES)
823 /* get aligned page from offset address */
824 #define get_aligned_page(offset) ((offset) >> PAGE_SHIFT)
825 /* get offset address from aligned page */
826 @@ -124,7 +125,7 @@ static int search_empty_map_area(struct snd_emu10k1 *emu, int npages, struct lis
827 }
828 page = blk->mapped_page + blk->pages;
829 }
830 - size = MAX_ALIGN_PAGES - page;
831 + size = (emu->address_mode ? MAX_ALIGN_PAGES1 : MAX_ALIGN_PAGES0) - page;
832 if (size >= max_size) {
833 *nextp = pos;
834 return page;
835 @@ -181,7 +182,7 @@ static int unmap_memblk(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *blk)
836 q = get_emu10k1_memblk(p, mapped_link);
837 end_page = q->mapped_page;
838 } else
839 - end_page = MAX_ALIGN_PAGES;
840 + end_page = (emu->address_mode ? MAX_ALIGN_PAGES1 : MAX_ALIGN_PAGES0);
841
842 /* remove links */
843 list_del(&blk->mapped_link);
844 @@ -305,7 +306,7 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst
845 if (snd_BUG_ON(!emu))
846 return NULL;
847 if (snd_BUG_ON(runtime->dma_bytes <= 0 ||
848 - runtime->dma_bytes >= MAXPAGES * EMUPAGESIZE))
849 + runtime->dma_bytes >= (emu->address_mode ? MAXPAGES1 : MAXPAGES0) * EMUPAGESIZE))
850 return NULL;
851 hdr = emu->memhdr;
852 if (snd_BUG_ON(!hdr))
853 diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
854 index 83a0f9b4452b..68261a778ee5 100644
855 --- a/sound/pci/hda/hda_codec.c
856 +++ b/sound/pci/hda/hda_codec.c
857 @@ -2078,6 +2078,16 @@ int snd_hda_codec_amp_init_stereo(struct hda_codec *codec, hda_nid_t nid,
858 }
859 EXPORT_SYMBOL_HDA(snd_hda_codec_amp_init_stereo);
860
861 +/* meta hook to call each driver's vmaster hook */
862 +static void vmaster_hook(void *private_data, int enabled)
863 +{
864 + struct hda_vmaster_mute_hook *hook = private_data;
865 +
866 + if (hook->mute_mode != HDA_VMUTE_FOLLOW_MASTER)
867 + enabled = hook->mute_mode;
868 + hook->hook(hook->codec, enabled);
869 +}
870 +
871 /**
872 * snd_hda_codec_resume_amp - Resume all AMP commands from the cache
873 * @codec: HD-audio codec
874 @@ -2772,9 +2782,9 @@ int snd_hda_add_vmaster_hook(struct hda_codec *codec,
875
876 if (!hook->hook || !hook->sw_kctl)
877 return 0;
878 - snd_ctl_add_vmaster_hook(hook->sw_kctl, hook->hook, codec);
879 hook->codec = codec;
880 hook->mute_mode = HDA_VMUTE_FOLLOW_MASTER;
881 + snd_ctl_add_vmaster_hook(hook->sw_kctl, vmaster_hook, hook);
882 if (!expose_enum_ctl)
883 return 0;
884 kctl = snd_ctl_new1(&vmaster_mute_mode, hook);
885 @@ -2797,14 +2807,7 @@ void snd_hda_sync_vmaster_hook(struct hda_vmaster_mute_hook *hook)
886 */
887 if (hook->codec->bus->shutdown)
888 return;
889 - switch (hook->mute_mode) {
890 - case HDA_VMUTE_FOLLOW_MASTER:
891 - snd_ctl_sync_vmaster_hook(hook->sw_kctl);
892 - break;
893 - default:
894 - hook->hook(hook->codec, hook->mute_mode);
895 - break;
896 - }
897 + snd_ctl_sync_vmaster_hook(hook->sw_kctl);
898 }
899 EXPORT_SYMBOL_HDA(snd_hda_sync_vmaster_hook);
900
901 diff --git a/sound/synth/emux/emux_oss.c b/sound/synth/emux/emux_oss.c
902 index 319754cf6208..daf61abc3670 100644
903 --- a/sound/synth/emux/emux_oss.c
904 +++ b/sound/synth/emux/emux_oss.c
905 @@ -118,12 +118,8 @@ snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure)
906 if (snd_BUG_ON(!arg || !emu))
907 return -ENXIO;
908
909 - mutex_lock(&emu->register_mutex);
910 -
911 - if (!snd_emux_inc_count(emu)) {
912 - mutex_unlock(&emu->register_mutex);
913 + if (!snd_emux_inc_count(emu))
914 return -EFAULT;
915 - }
916
917 memset(&callback, 0, sizeof(callback));
918 callback.owner = THIS_MODULE;
919 @@ -135,7 +131,6 @@ snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure)
920 if (p == NULL) {
921 snd_printk(KERN_ERR "can't create port\n");
922 snd_emux_dec_count(emu);
923 - mutex_unlock(&emu->register_mutex);
924 return -ENOMEM;
925 }
926
927 @@ -148,8 +143,6 @@ snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure)
928 reset_port_mode(p, arg->seq_mode);
929
930 snd_emux_reset_port(p);
931 -
932 - mutex_unlock(&emu->register_mutex);
933 return 0;
934 }
935
936 @@ -195,13 +188,11 @@ snd_emux_close_seq_oss(struct snd_seq_oss_arg *arg)
937 if (snd_BUG_ON(!emu))
938 return -ENXIO;
939
940 - mutex_lock(&emu->register_mutex);
941 snd_emux_sounds_off_all(p);
942 snd_soundfont_close_check(emu->sflist, SF_CLIENT_NO(p->chset.port));
943 snd_seq_event_port_detach(p->chset.client, p->chset.port);
944 snd_emux_dec_count(emu);
945
946 - mutex_unlock(&emu->register_mutex);
947 return 0;
948 }
949
950 diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c
951 index 7778b8e19782..a0209204ae48 100644
952 --- a/sound/synth/emux/emux_seq.c
953 +++ b/sound/synth/emux/emux_seq.c
954 @@ -124,12 +124,10 @@ snd_emux_detach_seq(struct snd_emux *emu)
955 if (emu->voices)
956 snd_emux_terminate_all(emu);
957
958 - mutex_lock(&emu->register_mutex);
959 if (emu->client >= 0) {
960 snd_seq_delete_kernel_client(emu->client);
961 emu->client = -1;
962 }
963 - mutex_unlock(&emu->register_mutex);
964 }
965
966
967 @@ -269,8 +267,8 @@ snd_emux_event_input(struct snd_seq_event *ev, int direct, void *private_data,
968 /*
969 * increment usage count
970 */
971 -int
972 -snd_emux_inc_count(struct snd_emux *emu)
973 +static int
974 +__snd_emux_inc_count(struct snd_emux *emu)
975 {
976 emu->used++;
977 if (!try_module_get(emu->ops.owner))
978 @@ -284,12 +282,21 @@ snd_emux_inc_count(struct snd_emux *emu)
979 return 1;
980 }
981
982 +int snd_emux_inc_count(struct snd_emux *emu)
983 +{
984 + int ret;
985 +
986 + mutex_lock(&emu->register_mutex);
987 + ret = __snd_emux_inc_count(emu);
988 + mutex_unlock(&emu->register_mutex);
989 + return ret;
990 +}
991
992 /*
993 * decrease usage count
994 */
995 -void
996 -snd_emux_dec_count(struct snd_emux *emu)
997 +static void
998 +__snd_emux_dec_count(struct snd_emux *emu)
999 {
1000 module_put(emu->card->module);
1001 emu->used--;
1002 @@ -298,6 +305,12 @@ snd_emux_dec_count(struct snd_emux *emu)
1003 module_put(emu->ops.owner);
1004 }
1005
1006 +void snd_emux_dec_count(struct snd_emux *emu)
1007 +{
1008 + mutex_lock(&emu->register_mutex);
1009 + __snd_emux_dec_count(emu);
1010 + mutex_unlock(&emu->register_mutex);
1011 +}
1012
1013 /*
1014 * Routine that is called upon a first use of a particular port
1015 @@ -317,7 +330,7 @@ snd_emux_use(void *private_data, struct snd_seq_port_subscribe *info)
1016
1017 mutex_lock(&emu->register_mutex);
1018 snd_emux_init_port(p);
1019 - snd_emux_inc_count(emu);
1020 + __snd_emux_inc_count(emu);
1021 mutex_unlock(&emu->register_mutex);
1022 return 0;
1023 }
1024 @@ -340,7 +353,7 @@ snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info)
1025
1026 mutex_lock(&emu->register_mutex);
1027 snd_emux_sounds_off_all(p);
1028 - snd_emux_dec_count(emu);
1029 + __snd_emux_dec_count(emu);
1030 mutex_unlock(&emu->register_mutex);
1031 return 0;
1032 }