diff options
author | Karsten Keil <kkeil@suse.de> | 2007-10-19 02:39:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-19 14:53:34 -0400 |
commit | 1e9c7813723c925623f2e21a93e2d5dc05ea8d12 (patch) | |
tree | 85d8652887aba6b32772bf2408dedbe10667e2cf /drivers | |
parent | eac141deb4f0136059372923ac3f0eab0bef5bce (diff) |
isdn: fix random hard freeze with AVM cards using b1dma
This fixes the hard freeze debugded for AVM C4 cards using the b1dma
interface.
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Karsten Keil <kkeil@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/isdn/hardware/avm/b1dma.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/drivers/isdn/hardware/avm/b1dma.c b/drivers/isdn/hardware/avm/b1dma.c index 428872b653e9..669f6f67449c 100644 --- a/drivers/isdn/hardware/avm/b1dma.c +++ b/drivers/isdn/hardware/avm/b1dma.c | |||
@@ -486,11 +486,13 @@ static void b1dma_handle_rx(avmcard *card) | |||
486 | card->name); | 486 | card->name); |
487 | } else { | 487 | } else { |
488 | memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); | 488 | memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); |
489 | if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF) | 489 | if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF) { |
490 | spin_lock(&card->lock); | ||
490 | capilib_data_b3_conf(&cinfo->ncci_head, ApplId, | 491 | capilib_data_b3_conf(&cinfo->ncci_head, ApplId, |
491 | CAPIMSG_NCCI(skb->data), | 492 | CAPIMSG_NCCI(skb->data), |
492 | CAPIMSG_MSGID(skb->data)); | 493 | CAPIMSG_MSGID(skb->data)); |
493 | 494 | spin_unlock(&card->lock); | |
495 | } | ||
494 | capi_ctr_handle_message(ctrl, ApplId, skb); | 496 | capi_ctr_handle_message(ctrl, ApplId, skb); |
495 | } | 497 | } |
496 | break; | 498 | break; |
@@ -500,9 +502,9 @@ static void b1dma_handle_rx(avmcard *card) | |||
500 | ApplId = _get_word(&p); | 502 | ApplId = _get_word(&p); |
501 | NCCI = _get_word(&p); | 503 | NCCI = _get_word(&p); |
502 | WindowSize = _get_word(&p); | 504 | WindowSize = _get_word(&p); |
503 | 505 | spin_lock(&card->lock); | |
504 | capilib_new_ncci(&cinfo->ncci_head, ApplId, NCCI, WindowSize); | 506 | capilib_new_ncci(&cinfo->ncci_head, ApplId, NCCI, WindowSize); |
505 | 507 | spin_unlock(&card->lock); | |
506 | break; | 508 | break; |
507 | 509 | ||
508 | case RECEIVE_FREE_NCCI: | 510 | case RECEIVE_FREE_NCCI: |
@@ -510,9 +512,11 @@ static void b1dma_handle_rx(avmcard *card) | |||
510 | ApplId = _get_word(&p); | 512 | ApplId = _get_word(&p); |
511 | NCCI = _get_word(&p); | 513 | NCCI = _get_word(&p); |
512 | 514 | ||
513 | if (NCCI != 0xffffffff) | 515 | if (NCCI != 0xffffffff) { |
516 | spin_lock(&card->lock); | ||
514 | capilib_free_ncci(&cinfo->ncci_head, ApplId, NCCI); | 517 | capilib_free_ncci(&cinfo->ncci_head, ApplId, NCCI); |
515 | 518 | spin_unlock(&card->lock); | |
519 | } | ||
516 | break; | 520 | break; |
517 | 521 | ||
518 | case RECEIVE_START: | 522 | case RECEIVE_START: |
@@ -751,10 +755,10 @@ void b1dma_reset_ctr(struct capi_ctr *ctrl) | |||
751 | 755 | ||
752 | spin_lock_irqsave(&card->lock, flags); | 756 | spin_lock_irqsave(&card->lock, flags); |
753 | b1dma_reset(card); | 757 | b1dma_reset(card); |
754 | spin_unlock_irqrestore(&card->lock, flags); | ||
755 | 758 | ||
756 | memset(cinfo->version, 0, sizeof(cinfo->version)); | 759 | memset(cinfo->version, 0, sizeof(cinfo->version)); |
757 | capilib_release(&cinfo->ncci_head); | 760 | capilib_release(&cinfo->ncci_head); |
761 | spin_unlock_irqrestore(&card->lock, flags); | ||
758 | capi_ctr_reseted(ctrl); | 762 | capi_ctr_reseted(ctrl); |
759 | } | 763 | } |
760 | 764 | ||
@@ -803,8 +807,11 @@ void b1dma_release_appl(struct capi_ctr *ctrl, u16 appl) | |||
803 | avmcard *card = cinfo->card; | 807 | avmcard *card = cinfo->card; |
804 | struct sk_buff *skb; | 808 | struct sk_buff *skb; |
805 | void *p; | 809 | void *p; |
810 | unsigned long flags; | ||
806 | 811 | ||
812 | spin_lock_irqsave(&card->lock, flags); | ||
807 | capilib_release_appl(&cinfo->ncci_head, appl); | 813 | capilib_release_appl(&cinfo->ncci_head, appl); |
814 | spin_unlock_irqrestore(&card->lock, flags); | ||
808 | 815 | ||
809 | skb = alloc_skb(7, GFP_ATOMIC); | 816 | skb = alloc_skb(7, GFP_ATOMIC); |
810 | if (!skb) { | 817 | if (!skb) { |
@@ -832,10 +839,13 @@ u16 b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb) | |||
832 | u16 retval = CAPI_NOERROR; | 839 | u16 retval = CAPI_NOERROR; |
833 | 840 | ||
834 | if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) { | 841 | if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) { |
842 | unsigned long flags; | ||
843 | spin_lock_irqsave(&card->lock, flags); | ||
835 | retval = capilib_data_b3_req(&cinfo->ncci_head, | 844 | retval = capilib_data_b3_req(&cinfo->ncci_head, |
836 | CAPIMSG_APPID(skb->data), | 845 | CAPIMSG_APPID(skb->data), |
837 | CAPIMSG_NCCI(skb->data), | 846 | CAPIMSG_NCCI(skb->data), |
838 | CAPIMSG_MSGID(skb->data)); | 847 | CAPIMSG_MSGID(skb->data)); |
848 | spin_unlock_irqrestore(&card->lock, flags); | ||
839 | } | 849 | } |
840 | if (retval == CAPI_NOERROR) | 850 | if (retval == CAPI_NOERROR) |
841 | b1dma_queue_tx(card, skb); | 851 | b1dma_queue_tx(card, skb); |