diff options
Diffstat (limited to 'drivers/media/video/pms.c')
| -rw-r--r-- | drivers/media/video/pms.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c index 9e6448639480..05ca55939e77 100644 --- a/drivers/media/video/pms.c +++ b/drivers/media/video/pms.c | |||
| @@ -30,6 +30,8 @@ | |||
| 30 | #include <asm/io.h> | 30 | #include <asm/io.h> |
| 31 | #include <linux/sched.h> | 31 | #include <linux/sched.h> |
| 32 | #include <linux/videodev.h> | 32 | #include <linux/videodev.h> |
| 33 | #include <linux/mutex.h> | ||
| 34 | |||
| 33 | #include <asm/uaccess.h> | 35 | #include <asm/uaccess.h> |
| 34 | 36 | ||
| 35 | 37 | ||
| @@ -44,7 +46,7 @@ struct pms_device | |||
| 44 | struct video_picture picture; | 46 | struct video_picture picture; |
| 45 | int height; | 47 | int height; |
| 46 | int width; | 48 | int width; |
| 47 | struct semaphore lock; | 49 | struct mutex lock; |
| 48 | }; | 50 | }; |
| 49 | 51 | ||
| 50 | struct i2c_info | 52 | struct i2c_info |
| @@ -724,10 +726,10 @@ static int pms_do_ioctl(struct inode *inode, struct file *file, | |||
| 724 | struct video_channel *v = arg; | 726 | struct video_channel *v = arg; |
| 725 | if(v->channel<0 || v->channel>3) | 727 | if(v->channel<0 || v->channel>3) |
| 726 | return -EINVAL; | 728 | return -EINVAL; |
| 727 | down(&pd->lock); | 729 | mutex_lock(&pd->lock); |
| 728 | pms_videosource(v->channel&1); | 730 | pms_videosource(v->channel&1); |
| 729 | pms_vcrinput(v->channel>>1); | 731 | pms_vcrinput(v->channel>>1); |
| 730 | up(&pd->lock); | 732 | mutex_unlock(&pd->lock); |
| 731 | return 0; | 733 | return 0; |
| 732 | } | 734 | } |
| 733 | case VIDIOCGTUNER: | 735 | case VIDIOCGTUNER: |
| @@ -761,7 +763,7 @@ static int pms_do_ioctl(struct inode *inode, struct file *file, | |||
| 761 | struct video_tuner *v = arg; | 763 | struct video_tuner *v = arg; |
| 762 | if(v->tuner) | 764 | if(v->tuner) |
| 763 | return -EINVAL; | 765 | return -EINVAL; |
| 764 | down(&pd->lock); | 766 | mutex_lock(&pd->lock); |
| 765 | switch(v->mode) | 767 | switch(v->mode) |
| 766 | { | 768 | { |
| 767 | case VIDEO_MODE_AUTO: | 769 | case VIDEO_MODE_AUTO: |
| @@ -785,10 +787,10 @@ static int pms_do_ioctl(struct inode *inode, struct file *file, | |||
| 785 | pms_format(2); | 787 | pms_format(2); |
| 786 | break; | 788 | break; |
| 787 | default: | 789 | default: |
| 788 | up(&pd->lock); | 790 | mutex_unlock(&pd->lock); |
| 789 | return -EINVAL; | 791 | return -EINVAL; |
| 790 | } | 792 | } |
| 791 | up(&pd->lock); | 793 | mutex_unlock(&pd->lock); |
| 792 | return 0; | 794 | return 0; |
| 793 | } | 795 | } |
| 794 | case VIDIOCGPICT: | 796 | case VIDIOCGPICT: |
| @@ -809,12 +811,12 @@ static int pms_do_ioctl(struct inode *inode, struct file *file, | |||
| 809 | * Now load the card. | 811 | * Now load the card. |
| 810 | */ | 812 | */ |
| 811 | 813 | ||
| 812 | down(&pd->lock); | 814 | mutex_lock(&pd->lock); |
| 813 | pms_brightness(p->brightness>>8); | 815 | pms_brightness(p->brightness>>8); |
| 814 | pms_hue(p->hue>>8); | 816 | pms_hue(p->hue>>8); |
| 815 | pms_colour(p->colour>>8); | 817 | pms_colour(p->colour>>8); |
| 816 | pms_contrast(p->contrast>>8); | 818 | pms_contrast(p->contrast>>8); |
| 817 | up(&pd->lock); | 819 | mutex_unlock(&pd->lock); |
| 818 | return 0; | 820 | return 0; |
| 819 | } | 821 | } |
| 820 | case VIDIOCSWIN: | 822 | case VIDIOCSWIN: |
| @@ -830,9 +832,9 @@ static int pms_do_ioctl(struct inode *inode, struct file *file, | |||
| 830 | return -EINVAL; | 832 | return -EINVAL; |
| 831 | pd->width=vw->width; | 833 | pd->width=vw->width; |
| 832 | pd->height=vw->height; | 834 | pd->height=vw->height; |
| 833 | down(&pd->lock); | 835 | mutex_lock(&pd->lock); |
| 834 | pms_resolution(pd->width, pd->height); | 836 | pms_resolution(pd->width, pd->height); |
| 835 | up(&pd->lock); /* Ok we figured out what to use from our wide choice */ | 837 | mutex_unlock(&pd->lock); /* Ok we figured out what to use from our wide choice */ |
| 836 | return 0; | 838 | return 0; |
| 837 | } | 839 | } |
| 838 | case VIDIOCGWIN: | 840 | case VIDIOCGWIN: |
| @@ -872,9 +874,9 @@ static ssize_t pms_read(struct file *file, char __user *buf, | |||
| 872 | struct pms_device *pd=(struct pms_device *)v; | 874 | struct pms_device *pd=(struct pms_device *)v; |
| 873 | int len; | 875 | int len; |
| 874 | 876 | ||
| 875 | down(&pd->lock); | 877 | mutex_lock(&pd->lock); |
| 876 | len=pms_capture(pd, buf, (pd->picture.depth==16)?0:1,count); | 878 | len=pms_capture(pd, buf, (pd->picture.depth==16)?0:1,count); |
| 877 | up(&pd->lock); | 879 | mutex_unlock(&pd->lock); |
| 878 | return len; | 880 | return len; |
| 879 | } | 881 | } |
| 880 | 882 | ||
| @@ -1029,7 +1031,7 @@ static int __init init_pms_cards(void) | |||
| 1029 | return -ENODEV; | 1031 | return -ENODEV; |
| 1030 | } | 1032 | } |
| 1031 | memcpy(&pms_device, &pms_template, sizeof(pms_template)); | 1033 | memcpy(&pms_device, &pms_template, sizeof(pms_template)); |
| 1032 | init_MUTEX(&pms_device.lock); | 1034 | mutex_init(&pms_device.lock); |
| 1033 | pms_device.height=240; | 1035 | pms_device.height=240; |
| 1034 | pms_device.width=320; | 1036 | pms_device.width=320; |
| 1035 | pms_swsense(75); | 1037 | pms_swsense(75); |
