diff options
author | Matthias Kaehlcke <matthias.kaehlcke@gmail.com> | 2007-09-06 17:18:15 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-12 17:55:24 -0400 |
commit | b5b80f2b20c833f979060cf48ae3ee6fbfa552be (patch) | |
tree | 6f806f8a31675252adcabf51c31d7d589fa8cb9d /drivers/usb/host/u132-hcd.c | |
parent | d853d872c14b9adc4adad29e56cd378b291f86e0 (diff) |
USB: ELAN U132 Host Controller Driver: convert sw_lock to mutex
The ELAN U132 Host Controller Driver uses the semaphore sw_lock as
mutex. Use the mutex API instead of the (binary) semaphore.
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/u132-hcd.c')
-rw-r--r-- | drivers/usb/host/u132-hcd.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c index 2b379a78d0d5..ac283b09a63f 100644 --- a/drivers/usb/host/u132-hcd.c +++ b/drivers/usb/host/u132-hcd.c | |||
@@ -183,7 +183,7 @@ struct u132_ring { | |||
183 | struct u132 { | 183 | struct u132 { |
184 | struct kref kref; | 184 | struct kref kref; |
185 | struct list_head u132_list; | 185 | struct list_head u132_list; |
186 | struct semaphore sw_lock; | 186 | struct mutex sw_lock; |
187 | struct semaphore scheduler_lock; | 187 | struct semaphore scheduler_lock; |
188 | struct u132_platform_data *board; | 188 | struct u132_platform_data *board; |
189 | struct platform_device *platform_dev; | 189 | struct platform_device *platform_dev; |
@@ -492,20 +492,20 @@ static void u132_hcd_monitor_work(struct work_struct *work) | |||
492 | return; | 492 | return; |
493 | } else { | 493 | } else { |
494 | int retval; | 494 | int retval; |
495 | down(&u132->sw_lock); | 495 | mutex_lock(&u132->sw_lock); |
496 | retval = read_roothub_info(u132); | 496 | retval = read_roothub_info(u132); |
497 | if (retval) { | 497 | if (retval) { |
498 | struct usb_hcd *hcd = u132_to_hcd(u132); | 498 | struct usb_hcd *hcd = u132_to_hcd(u132); |
499 | u132_disable(u132); | 499 | u132_disable(u132); |
500 | u132->going = 1; | 500 | u132->going = 1; |
501 | up(&u132->sw_lock); | 501 | mutex_unlock(&u132->sw_lock); |
502 | usb_hc_died(hcd); | 502 | usb_hc_died(hcd); |
503 | ftdi_elan_gone_away(u132->platform_dev); | 503 | ftdi_elan_gone_away(u132->platform_dev); |
504 | u132_monitor_put_kref(u132); | 504 | u132_monitor_put_kref(u132); |
505 | return; | 505 | return; |
506 | } else { | 506 | } else { |
507 | u132_monitor_requeue_work(u132, 500); | 507 | u132_monitor_requeue_work(u132, 500); |
508 | up(&u132->sw_lock); | 508 | mutex_unlock(&u132->sw_lock); |
509 | return; | 509 | return; |
510 | } | 510 | } |
511 | } | 511 | } |
@@ -1802,10 +1802,10 @@ static void u132_hcd_stop(struct usb_hcd *hcd) | |||
1802 | dev_err(&u132->platform_dev->dev, "device hcd=%p is being remov" | 1802 | dev_err(&u132->platform_dev->dev, "device hcd=%p is being remov" |
1803 | "ed\n", hcd); | 1803 | "ed\n", hcd); |
1804 | } else { | 1804 | } else { |
1805 | down(&u132->sw_lock); | 1805 | mutex_lock(&u132->sw_lock); |
1806 | msleep(100); | 1806 | msleep(100); |
1807 | u132_power(u132, 0); | 1807 | u132_power(u132, 0); |
1808 | up(&u132->sw_lock); | 1808 | mutex_unlock(&u132->sw_lock); |
1809 | } | 1809 | } |
1810 | } | 1810 | } |
1811 | 1811 | ||
@@ -1827,7 +1827,7 @@ static int u132_hcd_start(struct usb_hcd *hcd) | |||
1827 | (pdev->dev.platform_data))->vendor; | 1827 | (pdev->dev.platform_data))->vendor; |
1828 | u16 device = ((struct u132_platform_data *) | 1828 | u16 device = ((struct u132_platform_data *) |
1829 | (pdev->dev.platform_data))->device; | 1829 | (pdev->dev.platform_data))->device; |
1830 | down(&u132->sw_lock); | 1830 | mutex_lock(&u132->sw_lock); |
1831 | msleep(10); | 1831 | msleep(10); |
1832 | if (vendor == PCI_VENDOR_ID_AMD && device == 0x740c) { | 1832 | if (vendor == PCI_VENDOR_ID_AMD && device == 0x740c) { |
1833 | u132->flags = OHCI_QUIRK_AMD756; | 1833 | u132->flags = OHCI_QUIRK_AMD756; |
@@ -1842,7 +1842,7 @@ static int u132_hcd_start(struct usb_hcd *hcd) | |||
1842 | u132->going = 1; | 1842 | u132->going = 1; |
1843 | } | 1843 | } |
1844 | msleep(100); | 1844 | msleep(100); |
1845 | up(&u132->sw_lock); | 1845 | mutex_unlock(&u132->sw_lock); |
1846 | return retval; | 1846 | return retval; |
1847 | } else { | 1847 | } else { |
1848 | dev_err(&u132->platform_dev->dev, "platform_device missing\n"); | 1848 | dev_err(&u132->platform_dev->dev, "platform_device missing\n"); |
@@ -1862,13 +1862,13 @@ static int u132_hcd_reset(struct usb_hcd *hcd) | |||
1862 | return -ESHUTDOWN; | 1862 | return -ESHUTDOWN; |
1863 | } else { | 1863 | } else { |
1864 | int retval; | 1864 | int retval; |
1865 | down(&u132->sw_lock); | 1865 | mutex_lock(&u132->sw_lock); |
1866 | retval = u132_init(u132); | 1866 | retval = u132_init(u132); |
1867 | if (retval) { | 1867 | if (retval) { |
1868 | u132_disable(u132); | 1868 | u132_disable(u132); |
1869 | u132->going = 1; | 1869 | u132->going = 1; |
1870 | } | 1870 | } |
1871 | up(&u132->sw_lock); | 1871 | mutex_unlock(&u132->sw_lock); |
1872 | return retval; | 1872 | return retval; |
1873 | } | 1873 | } |
1874 | } | 1874 | } |
@@ -2865,7 +2865,7 @@ static int u132_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
2865 | return -ESHUTDOWN; | 2865 | return -ESHUTDOWN; |
2866 | } else { | 2866 | } else { |
2867 | int retval = 0; | 2867 | int retval = 0; |
2868 | down(&u132->sw_lock); | 2868 | mutex_lock(&u132->sw_lock); |
2869 | switch (typeReq) { | 2869 | switch (typeReq) { |
2870 | case ClearHubFeature: | 2870 | case ClearHubFeature: |
2871 | switch (wValue) { | 2871 | switch (wValue) { |
@@ -2928,7 +2928,7 @@ static int u132_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
2928 | stall:retval = -EPIPE; | 2928 | stall:retval = -EPIPE; |
2929 | break; | 2929 | break; |
2930 | } | 2930 | } |
2931 | up(&u132->sw_lock); | 2931 | mutex_unlock(&u132->sw_lock); |
2932 | return retval; | 2932 | return retval; |
2933 | } | 2933 | } |
2934 | } | 2934 | } |
@@ -3064,7 +3064,7 @@ static int __devexit u132_remove(struct platform_device *pdev) | |||
3064 | dev_err(&u132->platform_dev->dev, "removing device u132" | 3064 | dev_err(&u132->platform_dev->dev, "removing device u132" |
3065 | ".%d\n", u132->sequence_num); | 3065 | ".%d\n", u132->sequence_num); |
3066 | msleep(100); | 3066 | msleep(100); |
3067 | down(&u132->sw_lock); | 3067 | mutex_lock(&u132->sw_lock); |
3068 | u132_monitor_cancel_work(u132); | 3068 | u132_monitor_cancel_work(u132); |
3069 | while (rings-- > 0) { | 3069 | while (rings-- > 0) { |
3070 | struct u132_ring *ring = &u132->ring[rings]; | 3070 | struct u132_ring *ring = &u132->ring[rings]; |
@@ -3077,7 +3077,7 @@ static int __devexit u132_remove(struct platform_device *pdev) | |||
3077 | u132->going += 1; | 3077 | u132->going += 1; |
3078 | printk(KERN_INFO "removing device u132.%d\n", | 3078 | printk(KERN_INFO "removing device u132.%d\n", |
3079 | u132->sequence_num); | 3079 | u132->sequence_num); |
3080 | up(&u132->sw_lock); | 3080 | mutex_unlock(&u132->sw_lock); |
3081 | usb_remove_hcd(hcd); | 3081 | usb_remove_hcd(hcd); |
3082 | u132_u132_put_kref(u132); | 3082 | u132_u132_put_kref(u132); |
3083 | return 0; | 3083 | return 0; |
@@ -3097,7 +3097,7 @@ static void u132_initialise(struct u132 *u132, struct platform_device *pdev) | |||
3097 | u132->platform_dev = pdev; | 3097 | u132->platform_dev = pdev; |
3098 | u132->power = 0; | 3098 | u132->power = 0; |
3099 | u132->reset = 0; | 3099 | u132->reset = 0; |
3100 | init_MUTEX(&u132->sw_lock); | 3100 | mutex_init(&u132->sw_lock); |
3101 | init_MUTEX(&u132->scheduler_lock); | 3101 | init_MUTEX(&u132->scheduler_lock); |
3102 | while (rings-- > 0) { | 3102 | while (rings-- > 0) { |
3103 | struct u132_ring *ring = &u132->ring[rings]; | 3103 | struct u132_ring *ring = &u132->ring[rings]; |
@@ -3107,7 +3107,7 @@ static void u132_initialise(struct u132 *u132, struct platform_device *pdev) | |||
3107 | ring->curr_endp = NULL; | 3107 | ring->curr_endp = NULL; |
3108 | INIT_DELAYED_WORK(&ring->scheduler, | 3108 | INIT_DELAYED_WORK(&ring->scheduler, |
3109 | u132_hcd_ring_work_scheduler); | 3109 | u132_hcd_ring_work_scheduler); |
3110 | } down(&u132->sw_lock); | 3110 | } mutex_lock(&u132->sw_lock); |
3111 | INIT_DELAYED_WORK(&u132->monitor, u132_hcd_monitor_work); | 3111 | INIT_DELAYED_WORK(&u132->monitor, u132_hcd_monitor_work); |
3112 | while (ports-- > 0) { | 3112 | while (ports-- > 0) { |
3113 | struct u132_port *port = &u132->port[ports]; | 3113 | struct u132_port *port = &u132->port[ports]; |
@@ -3137,7 +3137,7 @@ static void u132_initialise(struct u132 *u132, struct platform_device *pdev) | |||
3137 | while (endps-- > 0) { | 3137 | while (endps-- > 0) { |
3138 | u132->endp[endps] = NULL; | 3138 | u132->endp[endps] = NULL; |
3139 | } | 3139 | } |
3140 | up(&u132->sw_lock); | 3140 | mutex_unlock(&u132->sw_lock); |
3141 | return; | 3141 | return; |
3142 | } | 3142 | } |
3143 | 3143 | ||