diff options
Diffstat (limited to 'drivers/isdn/gigaset/common.c')
-rw-r--r-- | drivers/isdn/gigaset/common.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c index e9bfcfd9f116..c3c9804796cd 100644 --- a/drivers/isdn/gigaset/common.c +++ b/drivers/isdn/gigaset/common.c | |||
@@ -408,7 +408,7 @@ void gigaset_freecs(struct cardstate *cs) | |||
408 | if (!cs) | 408 | if (!cs) |
409 | return; | 409 | return; |
410 | 410 | ||
411 | down(&cs->sem); | 411 | mutex_lock(&cs->mutex); |
412 | 412 | ||
413 | if (!cs->bcs) | 413 | if (!cs->bcs) |
414 | goto f_cs; | 414 | goto f_cs; |
@@ -459,7 +459,7 @@ void gigaset_freecs(struct cardstate *cs) | |||
459 | f_bcs: gig_dbg(DEBUG_INIT, "freeing bcs[]"); | 459 | f_bcs: gig_dbg(DEBUG_INIT, "freeing bcs[]"); |
460 | kfree(cs->bcs); | 460 | kfree(cs->bcs); |
461 | f_cs: gig_dbg(DEBUG_INIT, "freeing cs"); | 461 | f_cs: gig_dbg(DEBUG_INIT, "freeing cs"); |
462 | up(&cs->sem); | 462 | mutex_unlock(&cs->mutex); |
463 | free_cs(cs); | 463 | free_cs(cs); |
464 | } | 464 | } |
465 | EXPORT_SYMBOL_GPL(gigaset_freecs); | 465 | EXPORT_SYMBOL_GPL(gigaset_freecs); |
@@ -652,7 +652,9 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, | |||
652 | spin_lock_init(&cs->ev_lock); | 652 | spin_lock_init(&cs->ev_lock); |
653 | atomic_set(&cs->ev_tail, 0); | 653 | atomic_set(&cs->ev_tail, 0); |
654 | atomic_set(&cs->ev_head, 0); | 654 | atomic_set(&cs->ev_head, 0); |
655 | init_MUTEX_LOCKED(&cs->sem); | 655 | mutex_init(&cs->mutex); |
656 | mutex_lock(&cs->mutex); | ||
657 | |||
656 | tasklet_init(&cs->event_tasklet, &gigaset_handle_event, | 658 | tasklet_init(&cs->event_tasklet, &gigaset_handle_event, |
657 | (unsigned long) cs); | 659 | (unsigned long) cs); |
658 | atomic_set(&cs->commands_pending, 0); | 660 | atomic_set(&cs->commands_pending, 0); |
@@ -729,11 +731,11 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, | |||
729 | add_timer(&cs->timer); | 731 | add_timer(&cs->timer); |
730 | 732 | ||
731 | gig_dbg(DEBUG_INIT, "cs initialized"); | 733 | gig_dbg(DEBUG_INIT, "cs initialized"); |
732 | up(&cs->sem); | 734 | mutex_unlock(&cs->mutex); |
733 | return cs; | 735 | return cs; |
734 | 736 | ||
735 | error: if (cs) | 737 | error: if (cs) |
736 | up(&cs->sem); | 738 | mutex_unlock(&cs->mutex); |
737 | gig_dbg(DEBUG_INIT, "failed"); | 739 | gig_dbg(DEBUG_INIT, "failed"); |
738 | gigaset_freecs(cs); | 740 | gigaset_freecs(cs); |
739 | return NULL; | 741 | return NULL; |
@@ -831,7 +833,7 @@ static void cleanup_cs(struct cardstate *cs) | |||
831 | 833 | ||
832 | int gigaset_start(struct cardstate *cs) | 834 | int gigaset_start(struct cardstate *cs) |
833 | { | 835 | { |
834 | if (down_interruptible(&cs->sem)) | 836 | if (mutex_lock_interruptible(&cs->mutex)) |
835 | return 0; | 837 | return 0; |
836 | 838 | ||
837 | atomic_set(&cs->connected, 1); | 839 | atomic_set(&cs->connected, 1); |
@@ -861,18 +863,18 @@ int gigaset_start(struct cardstate *cs) | |||
861 | /* set up device sysfs */ | 863 | /* set up device sysfs */ |
862 | gigaset_init_dev_sysfs(cs); | 864 | gigaset_init_dev_sysfs(cs); |
863 | 865 | ||
864 | up(&cs->sem); | 866 | mutex_unlock(&cs->mutex); |
865 | return 1; | 867 | return 1; |
866 | 868 | ||
867 | error: | 869 | error: |
868 | up(&cs->sem); | 870 | mutex_unlock(&cs->mutex); |
869 | return 0; | 871 | return 0; |
870 | } | 872 | } |
871 | EXPORT_SYMBOL_GPL(gigaset_start); | 873 | EXPORT_SYMBOL_GPL(gigaset_start); |
872 | 874 | ||
873 | void gigaset_shutdown(struct cardstate *cs) | 875 | void gigaset_shutdown(struct cardstate *cs) |
874 | { | 876 | { |
875 | down(&cs->sem); | 877 | mutex_lock(&cs->mutex); |
876 | 878 | ||
877 | cs->waiting = 1; | 879 | cs->waiting = 1; |
878 | 880 | ||
@@ -902,13 +904,13 @@ void gigaset_shutdown(struct cardstate *cs) | |||
902 | cleanup_cs(cs); | 904 | cleanup_cs(cs); |
903 | 905 | ||
904 | exit: | 906 | exit: |
905 | up(&cs->sem); | 907 | mutex_unlock(&cs->mutex); |
906 | } | 908 | } |
907 | EXPORT_SYMBOL_GPL(gigaset_shutdown); | 909 | EXPORT_SYMBOL_GPL(gigaset_shutdown); |
908 | 910 | ||
909 | void gigaset_stop(struct cardstate *cs) | 911 | void gigaset_stop(struct cardstate *cs) |
910 | { | 912 | { |
911 | down(&cs->sem); | 913 | mutex_lock(&cs->mutex); |
912 | 914 | ||
913 | /* clear device sysfs */ | 915 | /* clear device sysfs */ |
914 | gigaset_free_dev_sysfs(cs); | 916 | gigaset_free_dev_sysfs(cs); |
@@ -936,7 +938,7 @@ void gigaset_stop(struct cardstate *cs) | |||
936 | cleanup_cs(cs); | 938 | cleanup_cs(cs); |
937 | 939 | ||
938 | exit: | 940 | exit: |
939 | up(&cs->sem); | 941 | mutex_unlock(&cs->mutex); |
940 | } | 942 | } |
941 | EXPORT_SYMBOL_GPL(gigaset_stop); | 943 | EXPORT_SYMBOL_GPL(gigaset_stop); |
942 | 944 | ||