diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-02-07 03:49:14 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-02-07 03:49:14 -0500 |
commit | 3593cab5d62c4c7abced1076710f9bc2d8847433 (patch) | |
tree | dd5dc21961f6b4aef6900b0c2eb63ce7c70aecd5 /drivers/media/dvb/cinergyT2 | |
parent | 538f9630afbbe429ecbcdcf92536200293a8e4b3 (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/cinergyT2')
-rw-r--r-- | drivers/media/dvb/cinergyT2/cinergyT2.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c index c4b4c5b6b7c8..29b7be5271d4 100644 --- a/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/drivers/media/dvb/cinergyT2/cinergyT2.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/pci.h> | 30 | #include <linux/pci.h> |
31 | #include <linux/input.h> | 31 | #include <linux/input.h> |
32 | #include <linux/dvb/frontend.h> | 32 | #include <linux/dvb/frontend.h> |
33 | #include <linux/mutex.h> | ||
33 | 34 | ||
34 | #include "dmxdev.h" | 35 | #include "dmxdev.h" |
35 | #include "dvb_demux.h" | 36 | #include "dvb_demux.h" |
@@ -116,7 +117,7 @@ static struct dvb_frontend_info cinergyt2_fe_info = { | |||
116 | struct cinergyt2 { | 117 | struct cinergyt2 { |
117 | struct dvb_demux demux; | 118 | struct dvb_demux demux; |
118 | struct usb_device *udev; | 119 | struct usb_device *udev; |
119 | struct semaphore sem; | 120 | struct mutex sem; |
120 | struct dvb_adapter adapter; | 121 | struct dvb_adapter adapter; |
121 | struct dvb_device *fedev; | 122 | struct dvb_device *fedev; |
122 | struct dmxdev dmxdev; | 123 | struct dmxdev dmxdev; |
@@ -345,14 +346,14 @@ static int cinergyt2_start_feed(struct dvb_demux_feed *dvbdmxfeed) | |||
345 | struct dvb_demux *demux = dvbdmxfeed->demux; | 346 | struct dvb_demux *demux = dvbdmxfeed->demux; |
346 | struct cinergyt2 *cinergyt2 = demux->priv; | 347 | struct cinergyt2 *cinergyt2 = demux->priv; |
347 | 348 | ||
348 | if (cinergyt2->disconnect_pending || down_interruptible(&cinergyt2->sem)) | 349 | if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) |
349 | return -ERESTARTSYS; | 350 | return -ERESTARTSYS; |
350 | 351 | ||
351 | if (cinergyt2->streaming == 0) | 352 | if (cinergyt2->streaming == 0) |
352 | cinergyt2_start_stream_xfer(cinergyt2); | 353 | cinergyt2_start_stream_xfer(cinergyt2); |
353 | 354 | ||
354 | cinergyt2->streaming++; | 355 | cinergyt2->streaming++; |
355 | up(&cinergyt2->sem); | 356 | mutex_unlock(&cinergyt2->sem); |
356 | return 0; | 357 | return 0; |
357 | } | 358 | } |
358 | 359 | ||
@@ -361,13 +362,13 @@ static int cinergyt2_stop_feed(struct dvb_demux_feed *dvbdmxfeed) | |||
361 | struct dvb_demux *demux = dvbdmxfeed->demux; | 362 | struct dvb_demux *demux = dvbdmxfeed->demux; |
362 | struct cinergyt2 *cinergyt2 = demux->priv; | 363 | struct cinergyt2 *cinergyt2 = demux->priv; |
363 | 364 | ||
364 | if (cinergyt2->disconnect_pending || down_interruptible(&cinergyt2->sem)) | 365 | if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) |
365 | return -ERESTARTSYS; | 366 | return -ERESTARTSYS; |
366 | 367 | ||
367 | if (--cinergyt2->streaming == 0) | 368 | if (--cinergyt2->streaming == 0) |
368 | cinergyt2_stop_stream_xfer(cinergyt2); | 369 | cinergyt2_stop_stream_xfer(cinergyt2); |
369 | 370 | ||
370 | up(&cinergyt2->sem); | 371 | mutex_unlock(&cinergyt2->sem); |
371 | return 0; | 372 | return 0; |
372 | } | 373 | } |
373 | 374 | ||
@@ -483,11 +484,11 @@ static int cinergyt2_open (struct inode *inode, struct file *file) | |||
483 | struct cinergyt2 *cinergyt2 = dvbdev->priv; | 484 | struct cinergyt2 *cinergyt2 = dvbdev->priv; |
484 | int err = -ERESTARTSYS; | 485 | int err = -ERESTARTSYS; |
485 | 486 | ||
486 | if (cinergyt2->disconnect_pending || down_interruptible(&cinergyt2->sem)) | 487 | if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) |
487 | return -ERESTARTSYS; | 488 | return -ERESTARTSYS; |
488 | 489 | ||
489 | if ((err = dvb_generic_open(inode, file))) { | 490 | if ((err = dvb_generic_open(inode, file))) { |
490 | up(&cinergyt2->sem); | 491 | mutex_unlock(&cinergyt2->sem); |
491 | return err; | 492 | return err; |
492 | } | 493 | } |
493 | 494 | ||
@@ -499,7 +500,7 @@ static int cinergyt2_open (struct inode *inode, struct file *file) | |||
499 | 500 | ||
500 | atomic_inc(&cinergyt2->inuse); | 501 | atomic_inc(&cinergyt2->inuse); |
501 | 502 | ||
502 | up(&cinergyt2->sem); | 503 | mutex_unlock(&cinergyt2->sem); |
503 | return 0; | 504 | return 0; |
504 | } | 505 | } |
505 | 506 | ||
@@ -517,7 +518,7 @@ static int cinergyt2_release (struct inode *inode, struct file *file) | |||
517 | struct dvb_device *dvbdev = file->private_data; | 518 | struct dvb_device *dvbdev = file->private_data; |
518 | struct cinergyt2 *cinergyt2 = dvbdev->priv; | 519 | struct cinergyt2 *cinergyt2 = dvbdev->priv; |
519 | 520 | ||
520 | if (down_interruptible(&cinergyt2->sem)) | 521 | if (mutex_lock_interruptible(&cinergyt2->sem)) |
521 | return -ERESTARTSYS; | 522 | return -ERESTARTSYS; |
522 | 523 | ||
523 | if (!cinergyt2->disconnect_pending && (file->f_flags & O_ACCMODE) != O_RDONLY) { | 524 | if (!cinergyt2->disconnect_pending && (file->f_flags & O_ACCMODE) != O_RDONLY) { |
@@ -526,7 +527,7 @@ static int cinergyt2_release (struct inode *inode, struct file *file) | |||
526 | cinergyt2_sleep(cinergyt2, 1); | 527 | cinergyt2_sleep(cinergyt2, 1); |
527 | } | 528 | } |
528 | 529 | ||
529 | up(&cinergyt2->sem); | 530 | mutex_unlock(&cinergyt2->sem); |
530 | 531 | ||
531 | if (atomic_dec_and_test(&cinergyt2->inuse) && cinergyt2->disconnect_pending) { | 532 | if (atomic_dec_and_test(&cinergyt2->inuse) && cinergyt2->disconnect_pending) { |
532 | warn("delayed unregister in release"); | 533 | warn("delayed unregister in release"); |
@@ -541,12 +542,12 @@ static unsigned int cinergyt2_poll (struct file *file, struct poll_table_struct | |||
541 | struct dvb_device *dvbdev = file->private_data; | 542 | struct dvb_device *dvbdev = file->private_data; |
542 | struct cinergyt2 *cinergyt2 = dvbdev->priv; | 543 | struct cinergyt2 *cinergyt2 = dvbdev->priv; |
543 | 544 | ||
544 | if (cinergyt2->disconnect_pending || down_interruptible(&cinergyt2->sem)) | 545 | if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) |
545 | return -ERESTARTSYS; | 546 | return -ERESTARTSYS; |
546 | 547 | ||
547 | poll_wait(file, &cinergyt2->poll_wq, wait); | 548 | poll_wait(file, &cinergyt2->poll_wq, wait); |
548 | 549 | ||
549 | up(&cinergyt2->sem); | 550 | mutex_unlock(&cinergyt2->sem); |
550 | 551 | ||
551 | return (POLLIN | POLLRDNORM | POLLPRI); | 552 | return (POLLIN | POLLRDNORM | POLLPRI); |
552 | } | 553 | } |
@@ -613,7 +614,7 @@ static int cinergyt2_ioctl (struct inode *inode, struct file *file, | |||
613 | if (copy_from_user(&p, (void __user*) arg, sizeof(p))) | 614 | if (copy_from_user(&p, (void __user*) arg, sizeof(p))) |
614 | return -EFAULT; | 615 | return -EFAULT; |
615 | 616 | ||
616 | if (cinergyt2->disconnect_pending || down_interruptible(&cinergyt2->sem)) | 617 | if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) |
617 | return -ERESTARTSYS; | 618 | return -ERESTARTSYS; |
618 | 619 | ||
619 | param->cmd = CINERGYT2_EP1_SET_TUNER_PARAMETERS; | 620 | param->cmd = CINERGYT2_EP1_SET_TUNER_PARAMETERS; |
@@ -629,7 +630,7 @@ static int cinergyt2_ioctl (struct inode *inode, struct file *file, | |||
629 | (char *) param, sizeof(*param), | 630 | (char *) param, sizeof(*param), |
630 | NULL, 0); | 631 | NULL, 0); |
631 | 632 | ||
632 | up(&cinergyt2->sem); | 633 | mutex_unlock(&cinergyt2->sem); |
633 | 634 | ||
634 | return (err < 0) ? err : 0; | 635 | return (err < 0) ? err : 0; |
635 | } | 636 | } |
@@ -724,7 +725,7 @@ static void cinergyt2_query_rc (void *data) | |||
724 | struct cinergyt2_rc_event rc_events[12]; | 725 | struct cinergyt2_rc_event rc_events[12]; |
725 | int n, len, i; | 726 | int n, len, i; |
726 | 727 | ||
727 | if (cinergyt2->disconnect_pending || down_interruptible(&cinergyt2->sem)) | 728 | if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) |
728 | return; | 729 | return; |
729 | 730 | ||
730 | len = cinergyt2_command(cinergyt2, buf, sizeof(buf), | 731 | len = cinergyt2_command(cinergyt2, buf, sizeof(buf), |
@@ -784,7 +785,7 @@ out: | |||
784 | schedule_delayed_work(&cinergyt2->rc_query_work, | 785 | schedule_delayed_work(&cinergyt2->rc_query_work, |
785 | msecs_to_jiffies(RC_QUERY_INTERVAL)); | 786 | msecs_to_jiffies(RC_QUERY_INTERVAL)); |
786 | 787 | ||
787 | up(&cinergyt2->sem); | 788 | mutex_unlock(&cinergyt2->sem); |
788 | } | 789 | } |
789 | 790 | ||
790 | static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2) | 791 | static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2) |
@@ -849,7 +850,7 @@ static void cinergyt2_query (void *data) | |||
849 | uint8_t lock_bits; | 850 | uint8_t lock_bits; |
850 | uint32_t unc; | 851 | uint32_t unc; |
851 | 852 | ||
852 | if (cinergyt2->disconnect_pending || down_interruptible(&cinergyt2->sem)) | 853 | if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) |
853 | return; | 854 | return; |
854 | 855 | ||
855 | unc = s->uncorrected_block_count; | 856 | unc = s->uncorrected_block_count; |
@@ -868,7 +869,7 @@ static void cinergyt2_query (void *data) | |||
868 | schedule_delayed_work(&cinergyt2->query_work, | 869 | schedule_delayed_work(&cinergyt2->query_work, |
869 | msecs_to_jiffies(QUERY_INTERVAL)); | 870 | msecs_to_jiffies(QUERY_INTERVAL)); |
870 | 871 | ||
871 | up(&cinergyt2->sem); | 872 | mutex_unlock(&cinergyt2->sem); |
872 | } | 873 | } |
873 | 874 | ||
874 | static int cinergyt2_probe (struct usb_interface *intf, | 875 | static int cinergyt2_probe (struct usb_interface *intf, |
@@ -885,7 +886,7 @@ static int cinergyt2_probe (struct usb_interface *intf, | |||
885 | memset (cinergyt2, 0, sizeof (struct cinergyt2)); | 886 | memset (cinergyt2, 0, sizeof (struct cinergyt2)); |
886 | usb_set_intfdata (intf, (void *) cinergyt2); | 887 | usb_set_intfdata (intf, (void *) cinergyt2); |
887 | 888 | ||
888 | init_MUTEX(&cinergyt2->sem); | 889 | mutex_init(&cinergyt2->sem); |
889 | init_waitqueue_head (&cinergyt2->poll_wq); | 890 | init_waitqueue_head (&cinergyt2->poll_wq); |
890 | INIT_WORK(&cinergyt2->query_work, cinergyt2_query, cinergyt2); | 891 | INIT_WORK(&cinergyt2->query_work, cinergyt2_query, cinergyt2); |
891 | 892 | ||
@@ -967,7 +968,7 @@ static int cinergyt2_suspend (struct usb_interface *intf, pm_message_t state) | |||
967 | { | 968 | { |
968 | struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); | 969 | struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); |
969 | 970 | ||
970 | if (cinergyt2->disconnect_pending || down_interruptible(&cinergyt2->sem)) | 971 | if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) |
971 | return -ERESTARTSYS; | 972 | return -ERESTARTSYS; |
972 | 973 | ||
973 | if (state.event > PM_EVENT_ON) { | 974 | if (state.event > PM_EVENT_ON) { |
@@ -981,7 +982,7 @@ static int cinergyt2_suspend (struct usb_interface *intf, pm_message_t state) | |||
981 | cinergyt2_sleep(cinergyt2, 1); | 982 | cinergyt2_sleep(cinergyt2, 1); |
982 | } | 983 | } |
983 | 984 | ||
984 | up(&cinergyt2->sem); | 985 | mutex_unlock(&cinergyt2->sem); |
985 | return 0; | 986 | return 0; |
986 | } | 987 | } |
987 | 988 | ||
@@ -990,7 +991,7 @@ static int cinergyt2_resume (struct usb_interface *intf) | |||
990 | struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); | 991 | struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); |
991 | struct dvbt_set_parameters_msg *param = &cinergyt2->param; | 992 | struct dvbt_set_parameters_msg *param = &cinergyt2->param; |
992 | 993 | ||
993 | if (cinergyt2->disconnect_pending || down_interruptible(&cinergyt2->sem)) | 994 | if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) |
994 | return -ERESTARTSYS; | 995 | return -ERESTARTSYS; |
995 | 996 | ||
996 | if (!cinergyt2->sleeping) { | 997 | if (!cinergyt2->sleeping) { |
@@ -1003,7 +1004,7 @@ static int cinergyt2_resume (struct usb_interface *intf) | |||
1003 | 1004 | ||
1004 | cinergyt2_resume_rc(cinergyt2); | 1005 | cinergyt2_resume_rc(cinergyt2); |
1005 | 1006 | ||
1006 | up(&cinergyt2->sem); | 1007 | mutex_unlock(&cinergyt2->sem); |
1007 | return 0; | 1008 | return 0; |
1008 | } | 1009 | } |
1009 | 1010 | ||