aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/class/cdc-acm.c
diff options
context:
space:
mode:
authorJarek Poplawski <jarkao2@o2.pl>2006-10-06 01:23:11 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-10-17 17:46:31 -0400
commit762f007b05446f5c63268fb2c28646f28959ee4b (patch)
tree48e35914e0e423b6014fa57cd3474fcacdc18a38 /drivers/usb/class/cdc-acm.c
parenta7a0c9cd1f45c2cae38ebe0951246bf94399818a (diff)
USB: fix cdc-acm problems with hard irq? (inconsistent lock state)
Signed-off-by: Jarek Poplawski <jarkao2@o2.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/class/cdc-acm.c')
-rw-r--r--drivers/usb/class/cdc-acm.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index daecdf0bff04..9a9012fd284b 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -325,7 +325,7 @@ static void acm_rx_tasklet(unsigned long _acm)
325 struct acm_rb *buf; 325 struct acm_rb *buf;
326 struct tty_struct *tty = acm->tty; 326 struct tty_struct *tty = acm->tty;
327 struct acm_ru *rcv; 327 struct acm_ru *rcv;
328 //unsigned long flags; 328 unsigned long flags;
329 int i = 0; 329 int i = 0;
330 dbg("Entering acm_rx_tasklet"); 330 dbg("Entering acm_rx_tasklet");
331 331
@@ -333,15 +333,15 @@ static void acm_rx_tasklet(unsigned long _acm)
333 return; 333 return;
334 334
335next_buffer: 335next_buffer:
336 spin_lock(&acm->read_lock); 336 spin_lock_irqsave(&acm->read_lock, flags);
337 if (list_empty(&acm->filled_read_bufs)) { 337 if (list_empty(&acm->filled_read_bufs)) {
338 spin_unlock(&acm->read_lock); 338 spin_unlock_irqrestore(&acm->read_lock, flags);
339 goto urbs; 339 goto urbs;
340 } 340 }
341 buf = list_entry(acm->filled_read_bufs.next, 341 buf = list_entry(acm->filled_read_bufs.next,
342 struct acm_rb, list); 342 struct acm_rb, list);
343 list_del(&buf->list); 343 list_del(&buf->list);
344 spin_unlock(&acm->read_lock); 344 spin_unlock_irqrestore(&acm->read_lock, flags);
345 345
346 dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d", buf, buf->size); 346 dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d", buf, buf->size);
347 347
@@ -356,29 +356,29 @@ next_buffer:
356 memmove(buf->base, buf->base + i, buf->size - i); 356 memmove(buf->base, buf->base + i, buf->size - i);
357 buf->size -= i; 357 buf->size -= i;
358 spin_unlock(&acm->throttle_lock); 358 spin_unlock(&acm->throttle_lock);
359 spin_lock(&acm->read_lock); 359 spin_lock_irqsave(&acm->read_lock, flags);
360 list_add(&buf->list, &acm->filled_read_bufs); 360 list_add(&buf->list, &acm->filled_read_bufs);
361 spin_unlock(&acm->read_lock); 361 spin_unlock_irqrestore(&acm->read_lock, flags);
362 return; 362 return;
363 } 363 }
364 spin_unlock(&acm->throttle_lock); 364 spin_unlock(&acm->throttle_lock);
365 365
366 spin_lock(&acm->read_lock); 366 spin_lock_irqsave(&acm->read_lock, flags);
367 list_add(&buf->list, &acm->spare_read_bufs); 367 list_add(&buf->list, &acm->spare_read_bufs);
368 spin_unlock(&acm->read_lock); 368 spin_unlock_irqrestore(&acm->read_lock, flags);
369 goto next_buffer; 369 goto next_buffer;
370 370
371urbs: 371urbs:
372 while (!list_empty(&acm->spare_read_bufs)) { 372 while (!list_empty(&acm->spare_read_bufs)) {
373 spin_lock(&acm->read_lock); 373 spin_lock_irqsave(&acm->read_lock, flags);
374 if (list_empty(&acm->spare_read_urbs)) { 374 if (list_empty(&acm->spare_read_urbs)) {
375 spin_unlock(&acm->read_lock); 375 spin_unlock_irqrestore(&acm->read_lock, flags);
376 return; 376 return;
377 } 377 }
378 rcv = list_entry(acm->spare_read_urbs.next, 378 rcv = list_entry(acm->spare_read_urbs.next,
379 struct acm_ru, list); 379 struct acm_ru, list);
380 list_del(&rcv->list); 380 list_del(&rcv->list);
381 spin_unlock(&acm->read_lock); 381 spin_unlock_irqrestore(&acm->read_lock, flags);
382 382
383 buf = list_entry(acm->spare_read_bufs.next, 383 buf = list_entry(acm->spare_read_bufs.next,
384 struct acm_rb, list); 384 struct acm_rb, list);
@@ -400,9 +400,9 @@ urbs:
400 free-urbs-pool and resubmited ASAP */ 400 free-urbs-pool and resubmited ASAP */
401 if (usb_submit_urb(rcv->urb, GFP_ATOMIC) < 0) { 401 if (usb_submit_urb(rcv->urb, GFP_ATOMIC) < 0) {
402 list_add(&buf->list, &acm->spare_read_bufs); 402 list_add(&buf->list, &acm->spare_read_bufs);
403 spin_lock(&acm->read_lock); 403 spin_lock_irqsave(&acm->read_lock, flags);
404 list_add(&rcv->list, &acm->spare_read_urbs); 404 list_add(&rcv->list, &acm->spare_read_urbs);
405 spin_unlock(&acm->read_lock); 405 spin_unlock_irqrestore(&acm->read_lock, flags);
406 return; 406 return;
407 } 407 }
408 } 408 }