Commit 67837f23 authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by Linus Torvalds

Use mutex instead of semaphore in CAPI 2.0 driver

The CAPI 2.0 driver uses a semaphore as mutex.  Use the mutex API instead of
the (binary) semaphore.
Signed-off-by: default avatarMatthias Kaehlcke <matthias.kaehlcke@gmail.com>
Acked-by: default avatarKarsten Keil <kkeil@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 94040828
...@@ -258,7 +258,7 @@ static void recv_handler(struct work_struct *work) ...@@ -258,7 +258,7 @@ static void recv_handler(struct work_struct *work)
if ((!ap) || (ap->release_in_progress)) if ((!ap) || (ap->release_in_progress))
return; return;
down(&ap->recv_sem); mutex_lock(&ap->recv_mtx);
while ((skb = skb_dequeue(&ap->recv_queue))) { while ((skb = skb_dequeue(&ap->recv_queue))) {
if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_IND) if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_IND)
ap->nrecvdatapkt++; ap->nrecvdatapkt++;
...@@ -267,7 +267,7 @@ static void recv_handler(struct work_struct *work) ...@@ -267,7 +267,7 @@ static void recv_handler(struct work_struct *work)
ap->recv_message(ap, skb); ap->recv_message(ap, skb);
} }
up(&ap->recv_sem); mutex_unlock(&ap->recv_mtx);
} }
void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *skb) void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *skb)
...@@ -547,7 +547,7 @@ u16 capi20_register(struct capi20_appl *ap) ...@@ -547,7 +547,7 @@ u16 capi20_register(struct capi20_appl *ap)
ap->nsentctlpkt = 0; ap->nsentctlpkt = 0;
ap->nsentdatapkt = 0; ap->nsentdatapkt = 0;
ap->callback = NULL; ap->callback = NULL;
init_MUTEX(&ap->recv_sem); mutex_init(&ap->recv_mtx);
skb_queue_head_init(&ap->recv_queue); skb_queue_head_init(&ap->recv_queue);
INIT_WORK(&ap->recv_work, recv_handler); INIT_WORK(&ap->recv_work, recv_handler);
ap->release_in_progress = 0; ap->release_in_progress = 0;
......
...@@ -64,7 +64,7 @@ struct capi20_appl { ...@@ -64,7 +64,7 @@ struct capi20_appl {
unsigned long nrecvdatapkt; unsigned long nrecvdatapkt;
unsigned long nsentctlpkt; unsigned long nsentctlpkt;
unsigned long nsentdatapkt; unsigned long nsentdatapkt;
struct semaphore recv_sem; struct mutex recv_mtx;
struct sk_buff_head recv_queue; struct sk_buff_head recv_queue;
struct work_struct recv_work; struct work_struct recv_work;
int release_in_progress; int release_in_progress;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment