aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/ttusb-dec
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-02-07 03:49:14 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-02-07 03:49:14 -0500
commit3593cab5d62c4c7abced1076710f9bc2d8847433 (patch)
treedd5dc21961f6b4aef6900b0c2eb63ce7c70aecd5 /drivers/media/dvb/ttusb-dec
parent538f9630afbbe429ecbcdcf92536200293a8e4b3 (diff)
V4L/DVB (3318b): sem2mutex: drivers/media/, #2
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/ttusb-dec')
-rw-r--r--drivers/media/dvb/ttusb-dec/ttusb_dec.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c
index df831171e03c..44dea3211848 100644
--- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c
+++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c
@@ -20,7 +20,8 @@
20 * 20 *
21 */ 21 */
22 22
23#include <asm/semaphore.h> 23#include <linux/mutex.h>
24
24#include <linux/list.h> 25#include <linux/list.h>
25#include <linux/module.h> 26#include <linux/module.h>
26#include <linux/moduleparam.h> 27#include <linux/moduleparam.h>
@@ -115,7 +116,7 @@ struct ttusb_dec {
115 unsigned int out_pipe; 116 unsigned int out_pipe;
116 unsigned int irq_pipe; 117 unsigned int irq_pipe;
117 enum ttusb_dec_interface interface; 118 enum ttusb_dec_interface interface;
118 struct semaphore usb_sem; 119 struct mutex usb_mutex;
119 120
120 void *irq_buffer; 121 void *irq_buffer;
121 struct urb *irq_urb; 122 struct urb *irq_urb;
@@ -124,7 +125,7 @@ struct ttusb_dec {
124 dma_addr_t iso_dma_handle; 125 dma_addr_t iso_dma_handle;
125 struct urb *iso_urb[ISO_BUF_COUNT]; 126 struct urb *iso_urb[ISO_BUF_COUNT];
126 int iso_stream_count; 127 int iso_stream_count;
127 struct semaphore iso_sem; 128 struct mutex iso_mutex;
128 129
129 u8 packet[MAX_PVA_LENGTH + 4]; 130 u8 packet[MAX_PVA_LENGTH + 4];
130 enum ttusb_dec_packet_type packet_type; 131 enum ttusb_dec_packet_type packet_type;
@@ -273,9 +274,9 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command,
273 if (!b) 274 if (!b)
274 return -ENOMEM; 275 return -ENOMEM;
275 276
276 if ((result = down_interruptible(&dec->usb_sem))) { 277 if ((result = mutex_lock_interruptible(&dec->usb_mutex))) {
277 kfree(b); 278 kfree(b);
278 printk("%s: Failed to down usb semaphore.\n", __FUNCTION__); 279 printk("%s: Failed to lock usb mutex.\n", __FUNCTION__);
279 return result; 280 return result;
280 } 281 }
281 282
@@ -300,7 +301,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command,
300 if (result) { 301 if (result) {
301 printk("%s: command bulk message failed: error %d\n", 302 printk("%s: command bulk message failed: error %d\n",
302 __FUNCTION__, result); 303 __FUNCTION__, result);
303 up(&dec->usb_sem); 304 mutex_unlock(&dec->usb_mutex);
304 kfree(b); 305 kfree(b);
305 return result; 306 return result;
306 } 307 }
@@ -311,7 +312,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command,
311 if (result) { 312 if (result) {
312 printk("%s: result bulk message failed: error %d\n", 313 printk("%s: result bulk message failed: error %d\n",
313 __FUNCTION__, result); 314 __FUNCTION__, result);
314 up(&dec->usb_sem); 315 mutex_unlock(&dec->usb_mutex);
315 kfree(b); 316 kfree(b);
316 return result; 317 return result;
317 } else { 318 } else {
@@ -327,7 +328,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command,
327 if (cmd_result && b[3] > 0) 328 if (cmd_result && b[3] > 0)
328 memcpy(cmd_result, &b[4], b[3]); 329 memcpy(cmd_result, &b[4], b[3]);
329 330
330 up(&dec->usb_sem); 331 mutex_unlock(&dec->usb_mutex);
331 332
332 kfree(b); 333 kfree(b);
333 return 0; 334 return 0;
@@ -835,7 +836,7 @@ static void ttusb_dec_stop_iso_xfer(struct ttusb_dec *dec)
835 836
836 dprintk("%s\n", __FUNCTION__); 837 dprintk("%s\n", __FUNCTION__);
837 838
838 if (down_interruptible(&dec->iso_sem)) 839 if (mutex_lock_interruptible(&dec->iso_mutex))
839 return; 840 return;
840 841
841 dec->iso_stream_count--; 842 dec->iso_stream_count--;
@@ -845,7 +846,7 @@ static void ttusb_dec_stop_iso_xfer(struct ttusb_dec *dec)
845 usb_kill_urb(dec->iso_urb[i]); 846 usb_kill_urb(dec->iso_urb[i]);
846 } 847 }
847 848
848 up(&dec->iso_sem); 849 mutex_unlock(&dec->iso_mutex);
849} 850}
850 851
851/* Setting the interface of the DEC tends to take down the USB communications 852/* Setting the interface of the DEC tends to take down the USB communications
@@ -890,7 +891,7 @@ static int ttusb_dec_start_iso_xfer(struct ttusb_dec *dec)
890 891
891 dprintk("%s\n", __FUNCTION__); 892 dprintk("%s\n", __FUNCTION__);
892 893
893 if (down_interruptible(&dec->iso_sem)) 894 if (mutex_lock_interruptible(&dec->iso_mutex))
894 return -EAGAIN; 895 return -EAGAIN;
895 896
896 if (!dec->iso_stream_count) { 897 if (!dec->iso_stream_count) {
@@ -911,7 +912,7 @@ static int ttusb_dec_start_iso_xfer(struct ttusb_dec *dec)
911 i--; 912 i--;
912 } 913 }
913 914
914 up(&dec->iso_sem); 915 mutex_unlock(&dec->iso_mutex);
915 return result; 916 return result;
916 } 917 }
917 } 918 }
@@ -919,7 +920,7 @@ static int ttusb_dec_start_iso_xfer(struct ttusb_dec *dec)
919 920
920 dec->iso_stream_count++; 921 dec->iso_stream_count++;
921 922
922 up(&dec->iso_sem); 923 mutex_unlock(&dec->iso_mutex);
923 924
924 return 0; 925 return 0;
925} 926}
@@ -1229,8 +1230,8 @@ static int ttusb_dec_init_usb(struct ttusb_dec *dec)
1229{ 1230{
1230 dprintk("%s\n", __FUNCTION__); 1231 dprintk("%s\n", __FUNCTION__);
1231 1232
1232 sema_init(&dec->usb_sem, 1); 1233 mutex_init(&dec->usb_mutex);
1233 sema_init(&dec->iso_sem, 1); 1234 mutex_init(&dec->iso_mutex);
1234 1235
1235 dec->command_pipe = usb_sndbulkpipe(dec->udev, COMMAND_PIPE); 1236 dec->command_pipe = usb_sndbulkpipe(dec->udev, COMMAND_PIPE);
1236 dec->result_pipe = usb_rcvbulkpipe(dec->udev, RESULT_PIPE); 1237 dec->result_pipe = usb_rcvbulkpipe(dec->udev, RESULT_PIPE);