aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2010-09-15 07:35:45 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-20 23:06:12 -0400
commitf2f8e8503e16985a784ed4e3fc5125fd5f86adf6 (patch)
tree5c0d1e96d4fa66739bd10ab4232f122b0fbba406 /drivers
parentcf9b475d5f9b58c23aca76b367f8318743d064e9 (diff)
V4L/DVB: radio-si470x: use unlocked ioctl
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/radio/si470x/radio-si470x-common.c27
-rw-r--r--drivers/media/radio/si470x/radio-si470x.h1
2 files changed, 22 insertions, 6 deletions
diff --git a/drivers/media/radio/si470x/radio-si470x-common.c b/drivers/media/radio/si470x/radio-si470x-common.c
index 9927a595b42..61be9887e6a 100644
--- a/drivers/media/radio/si470x/radio-si470x-common.c
+++ b/drivers/media/radio/si470x/radio-si470x-common.c
@@ -408,17 +408,15 @@ done:
408/* 408/*
409 * si470x_rds_on - switch on rds reception 409 * si470x_rds_on - switch on rds reception
410 */ 410 */
411int si470x_rds_on(struct si470x_device *radio) 411static int si470x_rds_on(struct si470x_device *radio)
412{ 412{
413 int retval; 413 int retval;
414 414
415 /* sysconfig 1 */ 415 /* sysconfig 1 */
416 mutex_lock(&radio->lock);
417 radio->registers[SYSCONFIG1] |= SYSCONFIG1_RDS; 416 radio->registers[SYSCONFIG1] |= SYSCONFIG1_RDS;
418 retval = si470x_set_register(radio, SYSCONFIG1); 417 retval = si470x_set_register(radio, SYSCONFIG1);
419 if (retval < 0) 418 if (retval < 0)
420 radio->registers[SYSCONFIG1] &= ~SYSCONFIG1_RDS; 419 radio->registers[SYSCONFIG1] &= ~SYSCONFIG1_RDS;
421 mutex_unlock(&radio->lock);
422 420
423 return retval; 421 return retval;
424} 422}
@@ -440,6 +438,7 @@ static ssize_t si470x_fops_read(struct file *file, char __user *buf,
440 unsigned int block_count = 0; 438 unsigned int block_count = 0;
441 439
442 /* switch on rds reception */ 440 /* switch on rds reception */
441 mutex_lock(&radio->lock);
443 if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0) 442 if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0)
444 si470x_rds_on(radio); 443 si470x_rds_on(radio);
445 444
@@ -480,9 +479,9 @@ static ssize_t si470x_fops_read(struct file *file, char __user *buf,
480 buf += 3; 479 buf += 3;
481 retval += 3; 480 retval += 3;
482 } 481 }
483 mutex_unlock(&radio->lock);
484 482
485done: 483done:
484 mutex_unlock(&radio->lock);
486 return retval; 485 return retval;
487} 486}
488 487
@@ -497,8 +496,11 @@ static unsigned int si470x_fops_poll(struct file *file,
497 int retval = 0; 496 int retval = 0;
498 497
499 /* switch on rds reception */ 498 /* switch on rds reception */
499
500 mutex_lock(&radio->lock);
500 if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0) 501 if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0)
501 si470x_rds_on(radio); 502 si470x_rds_on(radio);
503 mutex_unlock(&radio->lock);
502 504
503 poll_wait(file, &radio->read_queue, pts); 505 poll_wait(file, &radio->read_queue, pts);
504 506
@@ -516,7 +518,7 @@ static const struct v4l2_file_operations si470x_fops = {
516 .owner = THIS_MODULE, 518 .owner = THIS_MODULE,
517 .read = si470x_fops_read, 519 .read = si470x_fops_read,
518 .poll = si470x_fops_poll, 520 .poll = si470x_fops_poll,
519 .ioctl = video_ioctl2, 521 .unlocked_ioctl = video_ioctl2,
520 .open = si470x_fops_open, 522 .open = si470x_fops_open,
521 .release = si470x_fops_release, 523 .release = si470x_fops_release,
522}; 524};
@@ -572,6 +574,7 @@ static int si470x_vidioc_g_ctrl(struct file *file, void *priv,
572 struct si470x_device *radio = video_drvdata(file); 574 struct si470x_device *radio = video_drvdata(file);
573 int retval = 0; 575 int retval = 0;
574 576
577 mutex_lock(&radio->lock);
575 /* safety checks */ 578 /* safety checks */
576 retval = si470x_disconnect_check(radio); 579 retval = si470x_disconnect_check(radio);
577 if (retval) 580 if (retval)
@@ -594,6 +597,8 @@ done:
594 if (retval < 0) 597 if (retval < 0)
595 dev_warn(&radio->videodev->dev, 598 dev_warn(&radio->videodev->dev,
596 "get control failed with %d\n", retval); 599 "get control failed with %d\n", retval);
600
601 mutex_unlock(&radio->lock);
597 return retval; 602 return retval;
598} 603}
599 604
@@ -607,6 +612,7 @@ static int si470x_vidioc_s_ctrl(struct file *file, void *priv,
607 struct si470x_device *radio = video_drvdata(file); 612 struct si470x_device *radio = video_drvdata(file);
608 int retval = 0; 613 int retval = 0;
609 614
615 mutex_lock(&radio->lock);
610 /* safety checks */ 616 /* safety checks */
611 retval = si470x_disconnect_check(radio); 617 retval = si470x_disconnect_check(radio);
612 if (retval) 618 if (retval)
@@ -633,6 +639,7 @@ done:
633 if (retval < 0) 639 if (retval < 0)
634 dev_warn(&radio->videodev->dev, 640 dev_warn(&radio->videodev->dev,
635 "set control failed with %d\n", retval); 641 "set control failed with %d\n", retval);
642 mutex_unlock(&radio->lock);
636 return retval; 643 return retval;
637} 644}
638 645
@@ -662,6 +669,7 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv,
662 struct si470x_device *radio = video_drvdata(file); 669 struct si470x_device *radio = video_drvdata(file);
663 int retval = 0; 670 int retval = 0;
664 671
672 mutex_lock(&radio->lock);
665 /* safety checks */ 673 /* safety checks */
666 retval = si470x_disconnect_check(radio); 674 retval = si470x_disconnect_check(radio);
667 if (retval) 675 if (retval)
@@ -737,6 +745,7 @@ done:
737 if (retval < 0) 745 if (retval < 0)
738 dev_warn(&radio->videodev->dev, 746 dev_warn(&radio->videodev->dev,
739 "get tuner failed with %d\n", retval); 747 "get tuner failed with %d\n", retval);
748 mutex_unlock(&radio->lock);
740 return retval; 749 return retval;
741} 750}
742 751
@@ -750,6 +759,7 @@ static int si470x_vidioc_s_tuner(struct file *file, void *priv,
750 struct si470x_device *radio = video_drvdata(file); 759 struct si470x_device *radio = video_drvdata(file);
751 int retval = 0; 760 int retval = 0;
752 761
762 mutex_lock(&radio->lock);
753 /* safety checks */ 763 /* safety checks */
754 retval = si470x_disconnect_check(radio); 764 retval = si470x_disconnect_check(radio);
755 if (retval) 765 if (retval)
@@ -776,6 +786,7 @@ done:
776 if (retval < 0) 786 if (retval < 0)
777 dev_warn(&radio->videodev->dev, 787 dev_warn(&radio->videodev->dev,
778 "set tuner failed with %d\n", retval); 788 "set tuner failed with %d\n", retval);
789 mutex_unlock(&radio->lock);
779 return retval; 790 return retval;
780} 791}
781 792
@@ -790,6 +801,7 @@ static int si470x_vidioc_g_frequency(struct file *file, void *priv,
790 int retval = 0; 801 int retval = 0;
791 802
792 /* safety checks */ 803 /* safety checks */
804 mutex_lock(&radio->lock);
793 retval = si470x_disconnect_check(radio); 805 retval = si470x_disconnect_check(radio);
794 if (retval) 806 if (retval)
795 goto done; 807 goto done;
@@ -806,6 +818,7 @@ done:
806 if (retval < 0) 818 if (retval < 0)
807 dev_warn(&radio->videodev->dev, 819 dev_warn(&radio->videodev->dev,
808 "get frequency failed with %d\n", retval); 820 "get frequency failed with %d\n", retval);
821 mutex_unlock(&radio->lock);
809 return retval; 822 return retval;
810} 823}
811 824
@@ -819,6 +832,7 @@ static int si470x_vidioc_s_frequency(struct file *file, void *priv,
819 struct si470x_device *radio = video_drvdata(file); 832 struct si470x_device *radio = video_drvdata(file);
820 int retval = 0; 833 int retval = 0;
821 834
835 mutex_lock(&radio->lock);
822 /* safety checks */ 836 /* safety checks */
823 retval = si470x_disconnect_check(radio); 837 retval = si470x_disconnect_check(radio);
824 if (retval) 838 if (retval)
@@ -835,6 +849,7 @@ done:
835 if (retval < 0) 849 if (retval < 0)
836 dev_warn(&radio->videodev->dev, 850 dev_warn(&radio->videodev->dev,
837 "set frequency failed with %d\n", retval); 851 "set frequency failed with %d\n", retval);
852 mutex_unlock(&radio->lock);
838 return retval; 853 return retval;
839} 854}
840 855
@@ -848,6 +863,7 @@ static int si470x_vidioc_s_hw_freq_seek(struct file *file, void *priv,
848 struct si470x_device *radio = video_drvdata(file); 863 struct si470x_device *radio = video_drvdata(file);
849 int retval = 0; 864 int retval = 0;
850 865
866 mutex_lock(&radio->lock);
851 /* safety checks */ 867 /* safety checks */
852 retval = si470x_disconnect_check(radio); 868 retval = si470x_disconnect_check(radio);
853 if (retval) 869 if (retval)
@@ -864,6 +880,7 @@ done:
864 if (retval < 0) 880 if (retval < 0)
865 dev_warn(&radio->videodev->dev, 881 dev_warn(&radio->videodev->dev,
866 "set hardware frequency seek failed with %d\n", retval); 882 "set hardware frequency seek failed with %d\n", retval);
883 mutex_unlock(&radio->lock);
867 return retval; 884 return retval;
868} 885}
869 886
diff --git a/drivers/media/radio/si470x/radio-si470x.h b/drivers/media/radio/si470x/radio-si470x.h
index d3d86ba6e54..ea12782359a 100644
--- a/drivers/media/radio/si470x/radio-si470x.h
+++ b/drivers/media/radio/si470x/radio-si470x.h
@@ -220,7 +220,6 @@ int si470x_disconnect_check(struct si470x_device *radio);
220int si470x_set_freq(struct si470x_device *radio, unsigned int freq); 220int si470x_set_freq(struct si470x_device *radio, unsigned int freq);
221int si470x_start(struct si470x_device *radio); 221int si470x_start(struct si470x_device *radio);
222int si470x_stop(struct si470x_device *radio); 222int si470x_stop(struct si470x_device *radio);
223int si470x_rds_on(struct si470x_device *radio);
224int si470x_fops_open(struct file *file); 223int si470x_fops_open(struct file *file);
225int si470x_fops_release(struct file *file); 224int si470x_fops_release(struct file *file);
226int si470x_vidioc_querycap(struct file *file, void *priv, 225int si470x_vidioc_querycap(struct file *file, void *priv,