diff options
author | Arjan van de Ven <arjan@infradead.org> | 2006-01-13 09:52:55 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-31 20:23:40 -0500 |
commit | ab3c81ff639fbee4ab32af84c809d283b773084a (patch) | |
tree | 6981ca653daa753d2a6d0bbebd4a62b1755d91ef /drivers/usb/atm/usbatm.c | |
parent | a3673d3cd1cdeec6b503ffa418ca2d5aeff82fd7 (diff) |
[PATCH] USBATM: semaphore to mutex conversion
This is the usbatm part of the Arjan, Jes and Ingo
mass semaphore to mutex conversion, reworked to apply on top
of the patches I just sent to you. This time, with correct
attribution and signed-off lines.
Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Duncan Sands <baldrick@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/atm/usbatm.c')
-rw-r--r-- | drivers/usb/atm/usbatm.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index 5d339af16248..c1211fc037d9 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c | |||
@@ -823,7 +823,7 @@ static int usbatm_atm_open(struct atm_vcc *vcc) | |||
823 | return -EINVAL; | 823 | return -EINVAL; |
824 | } | 824 | } |
825 | 825 | ||
826 | down(&instance->serialize); /* vs self, usbatm_atm_close, usbatm_usb_disconnect */ | 826 | mutex_lock(&instance->serialize); /* vs self, usbatm_atm_close, usbatm_usb_disconnect */ |
827 | 827 | ||
828 | if (instance->disconnected) { | 828 | if (instance->disconnected) { |
829 | atm_dbg(instance, "%s: disconnected!\n", __func__); | 829 | atm_dbg(instance, "%s: disconnected!\n", __func__); |
@@ -867,7 +867,7 @@ static int usbatm_atm_open(struct atm_vcc *vcc) | |||
867 | set_bit(ATM_VF_PARTIAL, &vcc->flags); | 867 | set_bit(ATM_VF_PARTIAL, &vcc->flags); |
868 | set_bit(ATM_VF_READY, &vcc->flags); | 868 | set_bit(ATM_VF_READY, &vcc->flags); |
869 | 869 | ||
870 | up(&instance->serialize); | 870 | mutex_unlock(&instance->serialize); |
871 | 871 | ||
872 | atm_dbg(instance, "%s: allocated vcc data 0x%p\n", __func__, new); | 872 | atm_dbg(instance, "%s: allocated vcc data 0x%p\n", __func__, new); |
873 | 873 | ||
@@ -875,7 +875,7 @@ static int usbatm_atm_open(struct atm_vcc *vcc) | |||
875 | 875 | ||
876 | fail: | 876 | fail: |
877 | kfree(new); | 877 | kfree(new); |
878 | up(&instance->serialize); | 878 | mutex_unlock(&instance->serialize); |
879 | return ret; | 879 | return ret; |
880 | } | 880 | } |
881 | 881 | ||
@@ -896,7 +896,7 @@ static void usbatm_atm_close(struct atm_vcc *vcc) | |||
896 | 896 | ||
897 | usbatm_cancel_send(instance, vcc); | 897 | usbatm_cancel_send(instance, vcc); |
898 | 898 | ||
899 | down(&instance->serialize); /* vs self, usbatm_atm_open, usbatm_usb_disconnect */ | 899 | mutex_lock(&instance->serialize); /* vs self, usbatm_atm_open, usbatm_usb_disconnect */ |
900 | 900 | ||
901 | tasklet_disable(&instance->rx_channel.tasklet); | 901 | tasklet_disable(&instance->rx_channel.tasklet); |
902 | if (instance->cached_vcc == vcc_data) { | 902 | if (instance->cached_vcc == vcc_data) { |
@@ -919,7 +919,7 @@ static void usbatm_atm_close(struct atm_vcc *vcc) | |||
919 | clear_bit(ATM_VF_PARTIAL, &vcc->flags); | 919 | clear_bit(ATM_VF_PARTIAL, &vcc->flags); |
920 | clear_bit(ATM_VF_ADDR, &vcc->flags); | 920 | clear_bit(ATM_VF_ADDR, &vcc->flags); |
921 | 921 | ||
922 | up(&instance->serialize); | 922 | mutex_unlock(&instance->serialize); |
923 | 923 | ||
924 | atm_dbg(instance, "%s successful\n", __func__); | 924 | atm_dbg(instance, "%s successful\n", __func__); |
925 | } | 925 | } |
@@ -1009,9 +1009,9 @@ static int usbatm_do_heavy_init(void *arg) | |||
1009 | if (!ret) | 1009 | if (!ret) |
1010 | ret = usbatm_atm_init(instance); | 1010 | ret = usbatm_atm_init(instance); |
1011 | 1011 | ||
1012 | down(&instance->serialize); | 1012 | mutex_lock(&instance->serialize); |
1013 | instance->thread_pid = -1; | 1013 | instance->thread_pid = -1; |
1014 | up(&instance->serialize); | 1014 | mutex_unlock(&instance->serialize); |
1015 | 1015 | ||
1016 | complete_and_exit(&instance->thread_exited, ret); | 1016 | complete_and_exit(&instance->thread_exited, ret); |
1017 | } | 1017 | } |
@@ -1025,9 +1025,9 @@ static int usbatm_heavy_init(struct usbatm_data *instance) | |||
1025 | return ret; | 1025 | return ret; |
1026 | } | 1026 | } |
1027 | 1027 | ||
1028 | down(&instance->serialize); | 1028 | mutex_lock(&instance->serialize); |
1029 | instance->thread_pid = ret; | 1029 | instance->thread_pid = ret; |
1030 | up(&instance->serialize); | 1030 | mutex_unlock(&instance->serialize); |
1031 | 1031 | ||
1032 | wait_for_completion(&instance->thread_started); | 1032 | wait_for_completion(&instance->thread_started); |
1033 | 1033 | ||
@@ -1110,7 +1110,7 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id, | |||
1110 | /* private fields */ | 1110 | /* private fields */ |
1111 | 1111 | ||
1112 | kref_init(&instance->refcount); /* dropped in usbatm_usb_disconnect */ | 1112 | kref_init(&instance->refcount); /* dropped in usbatm_usb_disconnect */ |
1113 | init_MUTEX(&instance->serialize); | 1113 | mutex_init(&instance->serialize); |
1114 | 1114 | ||
1115 | instance->thread_pid = -1; | 1115 | instance->thread_pid = -1; |
1116 | init_completion(&instance->thread_started); | 1116 | init_completion(&instance->thread_started); |
@@ -1273,18 +1273,18 @@ void usbatm_usb_disconnect(struct usb_interface *intf) | |||
1273 | 1273 | ||
1274 | usb_set_intfdata(intf, NULL); | 1274 | usb_set_intfdata(intf, NULL); |
1275 | 1275 | ||
1276 | down(&instance->serialize); | 1276 | mutex_lock(&instance->serialize); |
1277 | instance->disconnected = 1; | 1277 | instance->disconnected = 1; |
1278 | if (instance->thread_pid >= 0) | 1278 | if (instance->thread_pid >= 0) |
1279 | kill_proc(instance->thread_pid, SIGTERM, 1); | 1279 | kill_proc(instance->thread_pid, SIGTERM, 1); |
1280 | up(&instance->serialize); | 1280 | mutex_unlock(&instance->serialize); |
1281 | 1281 | ||
1282 | wait_for_completion(&instance->thread_exited); | 1282 | wait_for_completion(&instance->thread_exited); |
1283 | 1283 | ||
1284 | down(&instance->serialize); | 1284 | mutex_lock(&instance->serialize); |
1285 | list_for_each_entry(vcc_data, &instance->vcc_list, list) | 1285 | list_for_each_entry(vcc_data, &instance->vcc_list, list) |
1286 | vcc_release_async(vcc_data->vcc, -EPIPE); | 1286 | vcc_release_async(vcc_data->vcc, -EPIPE); |
1287 | up(&instance->serialize); | 1287 | mutex_unlock(&instance->serialize); |
1288 | 1288 | ||
1289 | tasklet_disable(&instance->rx_channel.tasklet); | 1289 | tasklet_disable(&instance->rx_channel.tasklet); |
1290 | tasklet_disable(&instance->tx_channel.tasklet); | 1290 | tasklet_disable(&instance->tx_channel.tasklet); |