summaryrefslogtreecommitdiffstats
path: root/drivers/isdn/gigaset/common.c
diff options
context:
space:
mode:
authorTilman Schmidt <tilman@imap.cc>2006-04-10 22:55:12 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-11 06:18:50 -0700
commitabfd1dc7c18e4be89715071a524324c7b2515565 (patch)
tree84109f661246b66b2a7503164ec41e4382e37812 /drivers/isdn/gigaset/common.c
parent01371500b245ae63f542d74140a3d8ccb74d0318 (diff)
[PATCH] isdn4linux: Siemens Gigaset drivers: mutex conversion
With Hansjoerg Lipp <hjlipp@web.de> Convert the semaphores used by the Gigaset drivers to mutexes. Signed-off-by: Hansjoerg Lipp <hjlipp@web.de> Signed-off-by: Tilman Schmidt <tilman@imap.cc> Cc: Karsten Keil <kkeil@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/isdn/gigaset/common.c')
-rw-r--r--drivers/isdn/gigaset/common.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index e9bfcfd9f11..c3c9804796c 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -408,7 +408,7 @@ void gigaset_freecs(struct cardstate *cs)
if (!cs)
return;
- down(&cs->sem);
+ mutex_lock(&cs->mutex);
if (!cs->bcs)
goto f_cs;
@@ -459,7 +459,7 @@ void gigaset_freecs(struct cardstate *cs)
f_bcs: gig_dbg(DEBUG_INIT, "freeing bcs[]");
kfree(cs->bcs);
f_cs: gig_dbg(DEBUG_INIT, "freeing cs");
- up(&cs->sem);
+ mutex_unlock(&cs->mutex);
free_cs(cs);
}
EXPORT_SYMBOL_GPL(gigaset_freecs);
@@ -652,7 +652,9 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
spin_lock_init(&cs->ev_lock);
atomic_set(&cs->ev_tail, 0);
atomic_set(&cs->ev_head, 0);
- init_MUTEX_LOCKED(&cs->sem);
+ mutex_init(&cs->mutex);
+ mutex_lock(&cs->mutex);
+
tasklet_init(&cs->event_tasklet, &gigaset_handle_event,
(unsigned long) cs);
atomic_set(&cs->commands_pending, 0);
@@ -729,11 +731,11 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
add_timer(&cs->timer);
gig_dbg(DEBUG_INIT, "cs initialized");
- up(&cs->sem);
+ mutex_unlock(&cs->mutex);
return cs;
error: if (cs)
- up(&cs->sem);
+ mutex_unlock(&cs->mutex);
gig_dbg(DEBUG_INIT, "failed");
gigaset_freecs(cs);
return NULL;
@@ -831,7 +833,7 @@ static void cleanup_cs(struct cardstate *cs)
int gigaset_start(struct cardstate *cs)
{
- if (down_interruptible(&cs->sem))
+ if (mutex_lock_interruptible(&cs->mutex))
return 0;
atomic_set(&cs->connected, 1);
@@ -861,18 +863,18 @@ int gigaset_start(struct cardstate *cs)
/* set up device sysfs */
gigaset_init_dev_sysfs(cs);
- up(&cs->sem);
+ mutex_unlock(&cs->mutex);
return 1;
error:
- up(&cs->sem);
+ mutex_unlock(&cs->mutex);
return 0;
}
EXPORT_SYMBOL_GPL(gigaset_start);
void gigaset_shutdown(struct cardstate *cs)
{
- down(&cs->sem);
+ mutex_lock(&cs->mutex);
cs->waiting = 1;
@@ -902,13 +904,13 @@ void gigaset_shutdown(struct cardstate *cs)
cleanup_cs(cs);
exit:
- up(&cs->sem);
+ mutex_unlock(&cs->mutex);
}
EXPORT_SYMBOL_GPL(gigaset_shutdown);
void gigaset_stop(struct cardstate *cs)
{
- down(&cs->sem);
+ mutex_lock(&cs->mutex);
/* clear device sysfs */
gigaset_free_dev_sysfs(cs);
@@ -936,7 +938,7 @@ void gigaset_stop(struct cardstate *cs)
cleanup_cs(cs);
exit:
- up(&cs->sem);
+ mutex_unlock(&cs->mutex);
}
EXPORT_SYMBOL_GPL(gigaset_stop);