diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-15 10:07:59 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-18 23:13:37 -0400 |
commit | fd9a40da1db372833e1af6397d2f6c94ceff3dad (patch) | |
tree | edd301e5fffb4f62ffa504f917e11443b28eed17 /drivers | |
parent | 028d4c989ab9e839471739332d185f8f158b0043 (diff) |
V4L/DVB (12859): go7007: semaphore -> mutex conversion
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/go7007/go7007-driver.c | 12 | ||||
-rw-r--r-- | drivers/staging/go7007/go7007-i2c.c | 12 | ||||
-rw-r--r-- | drivers/staging/go7007/go7007-priv.h | 6 | ||||
-rw-r--r-- | drivers/staging/go7007/go7007-usb.c | 10 | ||||
-rw-r--r-- | drivers/staging/go7007/go7007-v4l2.c | 66 | ||||
-rw-r--r-- | drivers/staging/go7007/go7007.txt | 4 | ||||
-rw-r--r-- | drivers/staging/go7007/s2250-board.c | 18 | ||||
-rw-r--r-- | drivers/staging/go7007/s2250-loader.c | 8 | ||||
-rw-r--r-- | drivers/staging/go7007/snd-go7007.c | 2 |
9 files changed, 68 insertions, 70 deletions
diff --git a/drivers/staging/go7007/go7007-driver.c b/drivers/staging/go7007/go7007-driver.c index 77b1e769ac92..359a34f67597 100644 --- a/drivers/staging/go7007/go7007-driver.c +++ b/drivers/staging/go7007/go7007-driver.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/device.h> | 27 | #include <linux/device.h> |
28 | #include <linux/i2c.h> | 28 | #include <linux/i2c.h> |
29 | #include <linux/firmware.h> | 29 | #include <linux/firmware.h> |
30 | #include <linux/semaphore.h> | 30 | #include <linux/mutex.h> |
31 | #include <linux/uaccess.h> | 31 | #include <linux/uaccess.h> |
32 | #include <asm/system.h> | 32 | #include <asm/system.h> |
33 | #include <linux/videodev2.h> | 33 | #include <linux/videodev2.h> |
@@ -140,9 +140,9 @@ int go7007_boot_encoder(struct go7007 *go, int init_i2c) | |||
140 | { | 140 | { |
141 | int ret; | 141 | int ret; |
142 | 142 | ||
143 | down(&go->hw_lock); | 143 | mutex_lock(&go->hw_lock); |
144 | ret = go7007_load_encoder(go); | 144 | ret = go7007_load_encoder(go); |
145 | up(&go->hw_lock); | 145 | mutex_unlock(&go->hw_lock); |
146 | if (ret < 0) | 146 | if (ret < 0) |
147 | return -1; | 147 | return -1; |
148 | if (!init_i2c) | 148 | if (!init_i2c) |
@@ -257,9 +257,9 @@ int go7007_register_encoder(struct go7007 *go) | |||
257 | 257 | ||
258 | printk(KERN_INFO "go7007: registering new %s\n", go->name); | 258 | printk(KERN_INFO "go7007: registering new %s\n", go->name); |
259 | 259 | ||
260 | down(&go->hw_lock); | 260 | mutex_lock(&go->hw_lock); |
261 | ret = go7007_init_encoder(go); | 261 | ret = go7007_init_encoder(go); |
262 | up(&go->hw_lock); | 262 | mutex_unlock(&go->hw_lock); |
263 | if (ret < 0) | 263 | if (ret < 0) |
264 | return -1; | 264 | return -1; |
265 | 265 | ||
@@ -604,7 +604,7 @@ struct go7007 *go7007_alloc(struct go7007_board_info *board, struct device *dev) | |||
604 | go->tuner_type = -1; | 604 | go->tuner_type = -1; |
605 | go->channel_number = 0; | 605 | go->channel_number = 0; |
606 | go->name[0] = 0; | 606 | go->name[0] = 0; |
607 | init_MUTEX(&go->hw_lock); | 607 | mutex_init(&go->hw_lock); |
608 | init_waitqueue_head(&go->frame_waitq); | 608 | init_waitqueue_head(&go->frame_waitq); |
609 | spin_lock_init(&go->spinlock); | 609 | spin_lock_init(&go->spinlock); |
610 | go->video_dev = NULL; | 610 | go->video_dev = NULL; |
diff --git a/drivers/staging/go7007/go7007-i2c.c b/drivers/staging/go7007/go7007-i2c.c index c82867fdd28d..b8cfa1a6eaeb 100644 --- a/drivers/staging/go7007/go7007-i2c.c +++ b/drivers/staging/go7007/go7007-i2c.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/time.h> | 24 | #include <linux/time.h> |
25 | #include <linux/device.h> | 25 | #include <linux/device.h> |
26 | #include <linux/i2c.h> | 26 | #include <linux/i2c.h> |
27 | #include <linux/semaphore.h> | 27 | #include <linux/mutex.h> |
28 | #include <linux/uaccess.h> | 28 | #include <linux/uaccess.h> |
29 | #include <asm/system.h> | 29 | #include <asm/system.h> |
30 | 30 | ||
@@ -48,7 +48,7 @@ | |||
48 | 48 | ||
49 | /* There is only one I2C port on the TW2804 that feeds all four GO7007 VIPs | 49 | /* There is only one I2C port on the TW2804 that feeds all four GO7007 VIPs |
50 | * on the Adlink PCI-MPG24, so access is shared between all of them. */ | 50 | * on the Adlink PCI-MPG24, so access is shared between all of them. */ |
51 | static DECLARE_MUTEX(adlink_mpg24_i2c_lock); | 51 | static DEFINE_MUTEX(adlink_mpg24_i2c_lock); |
52 | 52 | ||
53 | static int go7007_i2c_xfer(struct go7007 *go, u16 addr, int read, | 53 | static int go7007_i2c_xfer(struct go7007 *go, u16 addr, int read, |
54 | u16 command, int flags, u8 *data) | 54 | u16 command, int flags, u8 *data) |
@@ -69,11 +69,11 @@ static int go7007_i2c_xfer(struct go7007 *go, u16 addr, int read, | |||
69 | *data, command, addr); | 69 | *data, command, addr); |
70 | #endif | 70 | #endif |
71 | 71 | ||
72 | down(&go->hw_lock); | 72 | mutex_lock(&go->hw_lock); |
73 | 73 | ||
74 | if (go->board_id == GO7007_BOARDID_ADLINK_MPG24) { | 74 | if (go->board_id == GO7007_BOARDID_ADLINK_MPG24) { |
75 | /* Bridge the I2C port on this GO7007 to the shared bus */ | 75 | /* Bridge the I2C port on this GO7007 to the shared bus */ |
76 | down(&adlink_mpg24_i2c_lock); | 76 | mutex_lock(&adlink_mpg24_i2c_lock); |
77 | go7007_write_addr(go, 0x3c82, 0x0020); | 77 | go7007_write_addr(go, 0x3c82, 0x0020); |
78 | } | 78 | } |
79 | 79 | ||
@@ -134,9 +134,9 @@ i2c_done: | |||
134 | if (go->board_id == GO7007_BOARDID_ADLINK_MPG24) { | 134 | if (go->board_id == GO7007_BOARDID_ADLINK_MPG24) { |
135 | /* Isolate the I2C port on this GO7007 from the shared bus */ | 135 | /* Isolate the I2C port on this GO7007 from the shared bus */ |
136 | go7007_write_addr(go, 0x3c82, 0x0000); | 136 | go7007_write_addr(go, 0x3c82, 0x0000); |
137 | up(&adlink_mpg24_i2c_lock); | 137 | mutex_unlock(&adlink_mpg24_i2c_lock); |
138 | } | 138 | } |
139 | up(&go->hw_lock); | 139 | mutex_unlock(&go->hw_lock); |
140 | return ret; | 140 | return ret; |
141 | } | 141 | } |
142 | 142 | ||
diff --git a/drivers/staging/go7007/go7007-priv.h b/drivers/staging/go7007/go7007-priv.h index 178d18119faa..ce9307e3e186 100644 --- a/drivers/staging/go7007/go7007-priv.h +++ b/drivers/staging/go7007/go7007-priv.h | |||
@@ -132,7 +132,7 @@ struct go7007_buffer { | |||
132 | 132 | ||
133 | struct go7007_file { | 133 | struct go7007_file { |
134 | struct go7007 *go; | 134 | struct go7007 *go; |
135 | struct semaphore lock; | 135 | struct mutex lock; |
136 | int buf_count; | 136 | int buf_count; |
137 | struct go7007_buffer *bufs; | 137 | struct go7007_buffer *bufs; |
138 | }; | 138 | }; |
@@ -170,7 +170,7 @@ struct go7007 { | |||
170 | int ref_count; | 170 | int ref_count; |
171 | enum { STATUS_INIT, STATUS_ONLINE, STATUS_SHUTDOWN } status; | 171 | enum { STATUS_INIT, STATUS_ONLINE, STATUS_SHUTDOWN } status; |
172 | spinlock_t spinlock; | 172 | spinlock_t spinlock; |
173 | struct semaphore hw_lock; | 173 | struct mutex hw_lock; |
174 | int streaming; | 174 | int streaming; |
175 | int in_use; | 175 | int in_use; |
176 | int audio_enabled; | 176 | int audio_enabled; |
@@ -240,7 +240,7 @@ struct go7007 { | |||
240 | unsigned short interrupt_data; | 240 | unsigned short interrupt_data; |
241 | }; | 241 | }; |
242 | 242 | ||
243 | /* All of these must be called with the hpi_lock semaphore held! */ | 243 | /* All of these must be called with the hpi_lock mutex held! */ |
244 | #define go7007_interface_reset(go) \ | 244 | #define go7007_interface_reset(go) \ |
245 | ((go)->hpi_ops->interface_reset(go)) | 245 | ((go)->hpi_ops->interface_reset(go)) |
246 | #define go7007_write_interrupt(go, x, y) \ | 246 | #define go7007_write_interrupt(go, x, y) \ |
diff --git a/drivers/staging/go7007/go7007-usb.c b/drivers/staging/go7007/go7007-usb.c index aa4a9e0b9954..ff4fb36d907d 100644 --- a/drivers/staging/go7007/go7007-usb.c +++ b/drivers/staging/go7007/go7007-usb.c | |||
@@ -62,7 +62,7 @@ struct go7007_usb_board { | |||
62 | 62 | ||
63 | struct go7007_usb { | 63 | struct go7007_usb { |
64 | struct go7007_usb_board *board; | 64 | struct go7007_usb_board *board; |
65 | struct semaphore i2c_lock; | 65 | struct mutex i2c_lock; |
66 | struct usb_device *usbdev; | 66 | struct usb_device *usbdev; |
67 | struct urb *video_urbs[8]; | 67 | struct urb *video_urbs[8]; |
68 | struct urb *audio_urbs[8]; | 68 | struct urb *audio_urbs[8]; |
@@ -734,7 +734,7 @@ static int go7007_usb_read_interrupt(struct go7007 *go) | |||
734 | static void go7007_usb_read_video_pipe_complete(struct urb *urb) | 734 | static void go7007_usb_read_video_pipe_complete(struct urb *urb) |
735 | { | 735 | { |
736 | struct go7007 *go = (struct go7007 *)urb->context; | 736 | struct go7007 *go = (struct go7007 *)urb->context; |
737 | int r, status = urb-> status; | 737 | int r, status = urb->status; |
738 | 738 | ||
739 | if (!go->streaming) { | 739 | if (!go->streaming) { |
740 | wake_up_interruptible(&go->frame_waitq); | 740 | wake_up_interruptible(&go->frame_waitq); |
@@ -877,7 +877,7 @@ static int go7007_usb_i2c_master_xfer(struct i2c_adapter *adapter, | |||
877 | if (go->status == STATUS_SHUTDOWN) | 877 | if (go->status == STATUS_SHUTDOWN) |
878 | return -1; | 878 | return -1; |
879 | 879 | ||
880 | down(&usb->i2c_lock); | 880 | mutex_lock(&usb->i2c_lock); |
881 | 881 | ||
882 | for (i = 0; i < num; ++i) { | 882 | for (i = 0; i < num; ++i) { |
883 | /* The hardware command is "write some bytes then read some | 883 | /* The hardware command is "write some bytes then read some |
@@ -935,7 +935,7 @@ static int go7007_usb_i2c_master_xfer(struct i2c_adapter *adapter, | |||
935 | ret = 0; | 935 | ret = 0; |
936 | 936 | ||
937 | i2c_done: | 937 | i2c_done: |
938 | up(&usb->i2c_lock); | 938 | mutex_unlock(&usb->i2c_lock); |
939 | return ret; | 939 | return ret; |
940 | } | 940 | } |
941 | 941 | ||
@@ -1065,7 +1065,7 @@ static int go7007_usb_probe(struct usb_interface *intf, | |||
1065 | if (board->flags & GO7007_USB_EZUSB_I2C) { | 1065 | if (board->flags & GO7007_USB_EZUSB_I2C) { |
1066 | memcpy(&go->i2c_adapter, &go7007_usb_adap_templ, | 1066 | memcpy(&go->i2c_adapter, &go7007_usb_adap_templ, |
1067 | sizeof(go7007_usb_adap_templ)); | 1067 | sizeof(go7007_usb_adap_templ)); |
1068 | init_MUTEX(&usb->i2c_lock); | 1068 | mutex_init(&usb->i2c_lock); |
1069 | go->i2c_adapter.dev.parent = go->dev; | 1069 | go->i2c_adapter.dev.parent = go->dev; |
1070 | i2c_set_adapdata(&go->i2c_adapter, go); | 1070 | i2c_set_adapdata(&go->i2c_adapter, go); |
1071 | if (i2c_add_adapter(&go->i2c_adapter) < 0) { | 1071 | if (i2c_add_adapter(&go->i2c_adapter) < 0) { |
diff --git a/drivers/staging/go7007/go7007-v4l2.c b/drivers/staging/go7007/go7007-v4l2.c index 06cacd37bbd8..1098cffb6a52 100644 --- a/drivers/staging/go7007/go7007-v4l2.c +++ b/drivers/staging/go7007/go7007-v4l2.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <media/v4l2-common.h> | 30 | #include <media/v4l2-common.h> |
31 | #include <media/v4l2-ioctl.h> | 31 | #include <media/v4l2-ioctl.h> |
32 | #include <linux/i2c.h> | 32 | #include <linux/i2c.h> |
33 | #include <linux/semaphore.h> | 33 | #include <linux/mutex.h> |
34 | #include <linux/uaccess.h> | 34 | #include <linux/uaccess.h> |
35 | #include <asm/system.h> | 35 | #include <asm/system.h> |
36 | 36 | ||
@@ -75,7 +75,7 @@ static int go7007_streamoff(struct go7007 *go) | |||
75 | int retval = -EINVAL; | 75 | int retval = -EINVAL; |
76 | unsigned long flags; | 76 | unsigned long flags; |
77 | 77 | ||
78 | down(&go->hw_lock); | 78 | mutex_lock(&go->hw_lock); |
79 | if (go->streaming) { | 79 | if (go->streaming) { |
80 | go->streaming = 0; | 80 | go->streaming = 0; |
81 | go7007_stream_stop(go); | 81 | go7007_stream_stop(go); |
@@ -85,7 +85,7 @@ static int go7007_streamoff(struct go7007 *go) | |||
85 | go7007_reset_encoder(go); | 85 | go7007_reset_encoder(go); |
86 | retval = 0; | 86 | retval = 0; |
87 | } | 87 | } |
88 | up(&go->hw_lock); | 88 | mutex_unlock(&go->hw_lock); |
89 | return 0; | 89 | return 0; |
90 | } | 90 | } |
91 | 91 | ||
@@ -101,7 +101,7 @@ static int go7007_open(struct file *file) | |||
101 | return -ENOMEM; | 101 | return -ENOMEM; |
102 | ++go->ref_count; | 102 | ++go->ref_count; |
103 | gofh->go = go; | 103 | gofh->go = go; |
104 | init_MUTEX(&gofh->lock); | 104 | mutex_init(&gofh->lock); |
105 | gofh->buf_count = 0; | 105 | gofh->buf_count = 0; |
106 | file->private_data = gofh; | 106 | file->private_data = gofh; |
107 | return 0; | 107 | return 0; |
@@ -705,14 +705,14 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
705 | req->memory != V4L2_MEMORY_MMAP) | 705 | req->memory != V4L2_MEMORY_MMAP) |
706 | return -EINVAL; | 706 | return -EINVAL; |
707 | 707 | ||
708 | down(&gofh->lock); | 708 | mutex_lock(&gofh->lock); |
709 | for (i = 0; i < gofh->buf_count; ++i) | 709 | for (i = 0; i < gofh->buf_count; ++i) |
710 | if (gofh->bufs[i].mapped > 0) | 710 | if (gofh->bufs[i].mapped > 0) |
711 | goto unlock_and_return; | 711 | goto unlock_and_return; |
712 | 712 | ||
713 | down(&go->hw_lock); | 713 | mutex_lock(&go->hw_lock); |
714 | if (go->in_use > 0 && gofh->buf_count == 0) { | 714 | if (go->in_use > 0 && gofh->buf_count == 0) { |
715 | up(&go->hw_lock); | 715 | mutex_unlock(&go->hw_lock); |
716 | goto unlock_and_return; | 716 | goto unlock_and_return; |
717 | } | 717 | } |
718 | 718 | ||
@@ -731,7 +731,7 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
731 | GFP_KERNEL); | 731 | GFP_KERNEL); |
732 | 732 | ||
733 | if (!gofh->bufs) { | 733 | if (!gofh->bufs) { |
734 | up(&go->hw_lock); | 734 | mutex_unlock(&go->hw_lock); |
735 | goto unlock_and_return; | 735 | goto unlock_and_return; |
736 | } | 736 | } |
737 | 737 | ||
@@ -750,8 +750,8 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
750 | } | 750 | } |
751 | 751 | ||
752 | gofh->buf_count = count; | 752 | gofh->buf_count = count; |
753 | up(&go->hw_lock); | 753 | mutex_unlock(&go->hw_lock); |
754 | up(&gofh->lock); | 754 | mutex_unlock(&gofh->lock); |
755 | 755 | ||
756 | memset(req, 0, sizeof(*req)); | 756 | memset(req, 0, sizeof(*req)); |
757 | 757 | ||
@@ -762,7 +762,7 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
762 | return 0; | 762 | return 0; |
763 | 763 | ||
764 | unlock_and_return: | 764 | unlock_and_return: |
765 | up(&gofh->lock); | 765 | mutex_unlock(&gofh->lock); |
766 | return retval; | 766 | return retval; |
767 | } | 767 | } |
768 | 768 | ||
@@ -778,7 +778,7 @@ static int vidioc_querybuf(struct file *file, void *priv, | |||
778 | 778 | ||
779 | index = buf->index; | 779 | index = buf->index; |
780 | 780 | ||
781 | down(&gofh->lock); | 781 | mutex_lock(&gofh->lock); |
782 | if (index >= gofh->buf_count) | 782 | if (index >= gofh->buf_count) |
783 | goto unlock_and_return; | 783 | goto unlock_and_return; |
784 | 784 | ||
@@ -802,12 +802,12 @@ static int vidioc_querybuf(struct file *file, void *priv, | |||
802 | buf->memory = V4L2_MEMORY_MMAP; | 802 | buf->memory = V4L2_MEMORY_MMAP; |
803 | buf->m.offset = index * GO7007_BUF_SIZE; | 803 | buf->m.offset = index * GO7007_BUF_SIZE; |
804 | buf->length = GO7007_BUF_SIZE; | 804 | buf->length = GO7007_BUF_SIZE; |
805 | up(&gofh->lock); | 805 | mutex_unlock(&gofh->lock); |
806 | 806 | ||
807 | return 0; | 807 | return 0; |
808 | 808 | ||
809 | unlock_and_return: | 809 | unlock_and_return: |
810 | up(&gofh->lock); | 810 | mutex_unlock(&gofh->lock); |
811 | return retval; | 811 | return retval; |
812 | } | 812 | } |
813 | 813 | ||
@@ -824,7 +824,7 @@ static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf) | |||
824 | buf->memory != V4L2_MEMORY_MMAP) | 824 | buf->memory != V4L2_MEMORY_MMAP) |
825 | return retval; | 825 | return retval; |
826 | 826 | ||
827 | down(&gofh->lock); | 827 | mutex_lock(&gofh->lock); |
828 | if (buf->index < 0 || buf->index >= gofh->buf_count) | 828 | if (buf->index < 0 || buf->index >= gofh->buf_count) |
829 | goto unlock_and_return; | 829 | goto unlock_and_return; |
830 | 830 | ||
@@ -865,12 +865,12 @@ static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf) | |||
865 | spin_lock_irqsave(&go->spinlock, flags); | 865 | spin_lock_irqsave(&go->spinlock, flags); |
866 | list_add_tail(&gobuf->stream, &go->stream); | 866 | list_add_tail(&gobuf->stream, &go->stream); |
867 | spin_unlock_irqrestore(&go->spinlock, flags); | 867 | spin_unlock_irqrestore(&go->spinlock, flags); |
868 | up(&gofh->lock); | 868 | mutex_unlock(&gofh->lock); |
869 | 869 | ||
870 | return 0; | 870 | return 0; |
871 | 871 | ||
872 | unlock_and_return: | 872 | unlock_and_return: |
873 | up(&gofh->lock); | 873 | mutex_unlock(&gofh->lock); |
874 | return retval; | 874 | return retval; |
875 | } | 875 | } |
876 | 876 | ||
@@ -890,7 +890,7 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf) | |||
890 | if (buf->memory != V4L2_MEMORY_MMAP) | 890 | if (buf->memory != V4L2_MEMORY_MMAP) |
891 | return retval; | 891 | return retval; |
892 | 892 | ||
893 | down(&gofh->lock); | 893 | mutex_lock(&gofh->lock); |
894 | if (list_empty(&go->stream)) | 894 | if (list_empty(&go->stream)) |
895 | goto unlock_and_return; | 895 | goto unlock_and_return; |
896 | gobuf = list_entry(go->stream.next, | 896 | gobuf = list_entry(go->stream.next, |
@@ -934,11 +934,11 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf) | |||
934 | buf->length = GO7007_BUF_SIZE; | 934 | buf->length = GO7007_BUF_SIZE; |
935 | buf->reserved = gobuf->modet_active; | 935 | buf->reserved = gobuf->modet_active; |
936 | 936 | ||
937 | up(&gofh->lock); | 937 | mutex_unlock(&gofh->lock); |
938 | return 0; | 938 | return 0; |
939 | 939 | ||
940 | unlock_and_return: | 940 | unlock_and_return: |
941 | up(&gofh->lock); | 941 | mutex_unlock(&gofh->lock); |
942 | return retval; | 942 | return retval; |
943 | } | 943 | } |
944 | 944 | ||
@@ -952,8 +952,8 @@ static int vidioc_streamon(struct file *file, void *priv, | |||
952 | if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 952 | if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
953 | return -EINVAL; | 953 | return -EINVAL; |
954 | 954 | ||
955 | down(&gofh->lock); | 955 | mutex_lock(&gofh->lock); |
956 | down(&go->hw_lock); | 956 | mutex_lock(&go->hw_lock); |
957 | 957 | ||
958 | if (!go->streaming) { | 958 | if (!go->streaming) { |
959 | go->streaming = 1; | 959 | go->streaming = 1; |
@@ -964,8 +964,8 @@ static int vidioc_streamon(struct file *file, void *priv, | |||
964 | else | 964 | else |
965 | retval = 0; | 965 | retval = 0; |
966 | } | 966 | } |
967 | up(&go->hw_lock); | 967 | mutex_unlock(&go->hw_lock); |
968 | up(&gofh->lock); | 968 | mutex_unlock(&gofh->lock); |
969 | 969 | ||
970 | return retval; | 970 | return retval; |
971 | } | 971 | } |
@@ -978,9 +978,9 @@ static int vidioc_streamoff(struct file *file, void *priv, | |||
978 | 978 | ||
979 | if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 979 | if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
980 | return -EINVAL; | 980 | return -EINVAL; |
981 | down(&gofh->lock); | 981 | mutex_lock(&gofh->lock); |
982 | go7007_streamoff(go); | 982 | go7007_streamoff(go); |
983 | up(&gofh->lock); | 983 | mutex_unlock(&gofh->lock); |
984 | 984 | ||
985 | return 0; | 985 | return 0; |
986 | } | 986 | } |
@@ -1734,18 +1734,18 @@ static int go7007_mmap(struct file *file, struct vm_area_struct *vma) | |||
1734 | return -EINVAL; /* only support VM_SHARED mapping */ | 1734 | return -EINVAL; /* only support VM_SHARED mapping */ |
1735 | if (vma->vm_end - vma->vm_start != GO7007_BUF_SIZE) | 1735 | if (vma->vm_end - vma->vm_start != GO7007_BUF_SIZE) |
1736 | return -EINVAL; /* must map exactly one full buffer */ | 1736 | return -EINVAL; /* must map exactly one full buffer */ |
1737 | down(&gofh->lock); | 1737 | mutex_lock(&gofh->lock); |
1738 | index = vma->vm_pgoff / GO7007_BUF_PAGES; | 1738 | index = vma->vm_pgoff / GO7007_BUF_PAGES; |
1739 | if (index >= gofh->buf_count) { | 1739 | if (index >= gofh->buf_count) { |
1740 | up(&gofh->lock); | 1740 | mutex_unlock(&gofh->lock); |
1741 | return -EINVAL; /* trying to map beyond requested buffers */ | 1741 | return -EINVAL; /* trying to map beyond requested buffers */ |
1742 | } | 1742 | } |
1743 | if (index * GO7007_BUF_PAGES != vma->vm_pgoff) { | 1743 | if (index * GO7007_BUF_PAGES != vma->vm_pgoff) { |
1744 | up(&gofh->lock); | 1744 | mutex_unlock(&gofh->lock); |
1745 | return -EINVAL; /* offset is not aligned on buffer boundary */ | 1745 | return -EINVAL; /* offset is not aligned on buffer boundary */ |
1746 | } | 1746 | } |
1747 | if (gofh->bufs[index].mapped > 0) { | 1747 | if (gofh->bufs[index].mapped > 0) { |
1748 | up(&gofh->lock); | 1748 | mutex_unlock(&gofh->lock); |
1749 | return -EBUSY; | 1749 | return -EBUSY; |
1750 | } | 1750 | } |
1751 | gofh->bufs[index].mapped = 1; | 1751 | gofh->bufs[index].mapped = 1; |
@@ -1754,7 +1754,7 @@ static int go7007_mmap(struct file *file, struct vm_area_struct *vma) | |||
1754 | vma->vm_flags |= VM_DONTEXPAND; | 1754 | vma->vm_flags |= VM_DONTEXPAND; |
1755 | vma->vm_flags &= ~VM_IO; | 1755 | vma->vm_flags &= ~VM_IO; |
1756 | vma->vm_private_data = &gofh->bufs[index]; | 1756 | vma->vm_private_data = &gofh->bufs[index]; |
1757 | up(&gofh->lock); | 1757 | mutex_unlock(&gofh->lock); |
1758 | return 0; | 1758 | return 0; |
1759 | } | 1759 | } |
1760 | 1760 | ||
@@ -1862,7 +1862,7 @@ void go7007_v4l2_remove(struct go7007 *go) | |||
1862 | { | 1862 | { |
1863 | unsigned long flags; | 1863 | unsigned long flags; |
1864 | 1864 | ||
1865 | down(&go->hw_lock); | 1865 | mutex_lock(&go->hw_lock); |
1866 | if (go->streaming) { | 1866 | if (go->streaming) { |
1867 | go->streaming = 0; | 1867 | go->streaming = 0; |
1868 | go7007_stream_stop(go); | 1868 | go7007_stream_stop(go); |
@@ -1870,7 +1870,7 @@ void go7007_v4l2_remove(struct go7007 *go) | |||
1870 | abort_queued(go); | 1870 | abort_queued(go); |
1871 | spin_unlock_irqrestore(&go->spinlock, flags); | 1871 | spin_unlock_irqrestore(&go->spinlock, flags); |
1872 | } | 1872 | } |
1873 | up(&go->hw_lock); | 1873 | mutex_unlock(&go->hw_lock); |
1874 | if (go->video_dev) | 1874 | if (go->video_dev) |
1875 | video_unregister_device(go->video_dev); | 1875 | video_unregister_device(go->video_dev); |
1876 | } | 1876 | } |
diff --git a/drivers/staging/go7007/go7007.txt b/drivers/staging/go7007/go7007.txt index 7656c0833c54..06a76da32128 100644 --- a/drivers/staging/go7007/go7007.txt +++ b/drivers/staging/go7007/go7007.txt | |||
@@ -2,7 +2,7 @@ This is a driver for the WIS GO7007SB multi-format video encoder. | |||
2 | 2 | ||
3 | Pete Eberlein <pete@sensoray.com> | 3 | Pete Eberlein <pete@sensoray.com> |
4 | 4 | ||
5 | The driver was originally released under the GPL and is currently hosted at: | 5 | The driver was orignally released under the GPL and is currently hosted at: |
6 | http://nikosapi.org/wiki/index.php/WIS_Go7007_Linux_driver | 6 | http://nikosapi.org/wiki/index.php/WIS_Go7007_Linux_driver |
7 | The go7007 firmware can be acquired from the package on the site above. | 7 | The go7007 firmware can be acquired from the package on the site above. |
8 | 8 | ||
@@ -24,7 +24,7 @@ These should be used instead of the non-standard GO7007 ioctls described | |||
24 | below. | 24 | below. |
25 | 25 | ||
26 | 26 | ||
27 | The README files from the original package appears below: | 27 | The README files from the orignal package appear below: |
28 | 28 | ||
29 | --------------------------------------------------------------------------- | 29 | --------------------------------------------------------------------------- |
30 | WIS GO7007SB Public Linux Driver | 30 | WIS GO7007SB Public Linux Driver |
diff --git a/drivers/staging/go7007/s2250-board.c b/drivers/staging/go7007/s2250-board.c index b398db43d376..f35f0776c2fe 100644 --- a/drivers/staging/go7007/s2250-board.c +++ b/drivers/staging/go7007/s2250-board.c | |||
@@ -21,12 +21,10 @@ | |||
21 | #include <linux/i2c.h> | 21 | #include <linux/i2c.h> |
22 | #include <linux/videodev2.h> | 22 | #include <linux/videodev2.h> |
23 | #include <media/v4l2-common.h> | 23 | #include <media/v4l2-common.h> |
24 | #include "s2250-loader.h" | ||
24 | #include "go7007-priv.h" | 25 | #include "go7007-priv.h" |
25 | #include "wis-i2c.h" | 26 | #include "wis-i2c.h" |
26 | 27 | ||
27 | extern int s2250loader_init(void); | ||
28 | extern void s2250loader_cleanup(void); | ||
29 | |||
30 | #define TLV320_ADDRESS 0x34 | 28 | #define TLV320_ADDRESS 0x34 |
31 | #define VPX322_ADDR_ANALOGCONTROL1 0x02 | 29 | #define VPX322_ADDR_ANALOGCONTROL1 0x02 |
32 | #define VPX322_ADDR_BRIGHTNESS0 0x0127 | 30 | #define VPX322_ADDR_BRIGHTNESS0 0x0127 |
@@ -43,7 +41,7 @@ struct go7007_usb_board { | |||
43 | 41 | ||
44 | struct go7007_usb { | 42 | struct go7007_usb { |
45 | struct go7007_usb_board *board; | 43 | struct go7007_usb_board *board; |
46 | struct semaphore i2c_lock; | 44 | struct mutex i2c_lock; |
47 | struct usb_device *usbdev; | 45 | struct usb_device *usbdev; |
48 | struct urb *video_urbs[8]; | 46 | struct urb *video_urbs[8]; |
49 | struct urb *audio_urbs[8]; | 47 | struct urb *audio_urbs[8]; |
@@ -165,7 +163,7 @@ static int write_reg(struct i2c_client *client, u8 reg, u8 value) | |||
165 | return -ENOMEM; | 163 | return -ENOMEM; |
166 | 164 | ||
167 | usb = go->hpi_context; | 165 | usb = go->hpi_context; |
168 | if (down_interruptible(&usb->i2c_lock) != 0) { | 166 | if (mutex_lock_interruptible(&usb->i2c_lock) != 0) { |
169 | printk(KERN_INFO "i2c lock failed\n"); | 167 | printk(KERN_INFO "i2c lock failed\n"); |
170 | kfree(buf); | 168 | kfree(buf); |
171 | return -EINTR; | 169 | return -EINTR; |
@@ -175,7 +173,7 @@ static int write_reg(struct i2c_client *client, u8 reg, u8 value) | |||
175 | buf, | 173 | buf, |
176 | 16, 1); | 174 | 16, 1); |
177 | 175 | ||
178 | up(&usb->i2c_lock); | 176 | mutex_unlock(&usb->i2c_lock); |
179 | kfree(buf); | 177 | kfree(buf); |
180 | return rc; | 178 | return rc; |
181 | } | 179 | } |
@@ -203,14 +201,14 @@ static int write_reg_fp(struct i2c_client *client, u16 addr, u16 val) | |||
203 | memset(buf, 0xcd, 6); | 201 | memset(buf, 0xcd, 6); |
204 | 202 | ||
205 | usb = go->hpi_context; | 203 | usb = go->hpi_context; |
206 | if (down_interruptible(&usb->i2c_lock) != 0) { | 204 | if (mutex_lock_interruptible(&usb->i2c_lock) != 0) { |
207 | printk(KERN_INFO "i2c lock failed\n"); | 205 | printk(KERN_INFO "i2c lock failed\n"); |
208 | return -EINTR; | 206 | return -EINTR; |
209 | } | 207 | } |
210 | if (go7007_usb_vendor_request(go, 0x57, addr, val, buf, 16, 1) < 0) | 208 | if (go7007_usb_vendor_request(go, 0x57, addr, val, buf, 16, 1) < 0) |
211 | return -EFAULT; | 209 | return -EFAULT; |
212 | 210 | ||
213 | up(&usb->i2c_lock); | 211 | mutex_unlock(&usb->i2c_lock); |
214 | if (buf[0] == 0) { | 212 | if (buf[0] == 0) { |
215 | unsigned int subaddr, val_read; | 213 | unsigned int subaddr, val_read; |
216 | 214 | ||
@@ -541,7 +539,7 @@ static int s2250_probe(struct i2c_client *client, | |||
541 | dec->audio_input = 0; | 539 | dec->audio_input = 0; |
542 | write_reg(client, 0x08, 0x02); /* Line In */ | 540 | write_reg(client, 0x08, 0x02); /* Line In */ |
543 | 541 | ||
544 | if (down_interruptible(&usb->i2c_lock) == 0) { | 542 | if (mutex_lock_interruptible(&usb->i2c_lock) == 0) { |
545 | data = kzalloc(16, GFP_KERNEL); | 543 | data = kzalloc(16, GFP_KERNEL); |
546 | if (data != NULL) { | 544 | if (data != NULL) { |
547 | int rc; | 545 | int rc; |
@@ -560,7 +558,7 @@ static int s2250_probe(struct i2c_client *client, | |||
560 | } | 558 | } |
561 | kfree(data); | 559 | kfree(data); |
562 | } | 560 | } |
563 | up(&usb->i2c_lock); | 561 | mutex_unlock(&usb->i2c_lock); |
564 | } | 562 | } |
565 | 563 | ||
566 | printk("s2250: initialized successfully\n"); | 564 | printk("s2250: initialized successfully\n"); |
diff --git a/drivers/staging/go7007/s2250-loader.c b/drivers/staging/go7007/s2250-loader.c index bb22347af60e..d7bf82983274 100644 --- a/drivers/staging/go7007/s2250-loader.c +++ b/drivers/staging/go7007/s2250-loader.c | |||
@@ -35,7 +35,7 @@ typedef struct device_extension_s { | |||
35 | #define MAX_DEVICES 256 | 35 | #define MAX_DEVICES 256 |
36 | 36 | ||
37 | static pdevice_extension_t s2250_dev_table[MAX_DEVICES]; | 37 | static pdevice_extension_t s2250_dev_table[MAX_DEVICES]; |
38 | static DECLARE_MUTEX(s2250_dev_table_mutex); | 38 | static DEFINE_MUTEX(s2250_dev_table_mutex); |
39 | 39 | ||
40 | #define to_s2250loader_dev_common(d) container_of(d, device_extension_t, kref) | 40 | #define to_s2250loader_dev_common(d) container_of(d, device_extension_t, kref) |
41 | static void s2250loader_delete(struct kref *kref) | 41 | static void s2250loader_delete(struct kref *kref) |
@@ -67,7 +67,7 @@ static int s2250loader_probe(struct usb_interface *interface, | |||
67 | printk(KERN_ERR "can't handle multiple config\n"); | 67 | printk(KERN_ERR "can't handle multiple config\n"); |
68 | return -1; | 68 | return -1; |
69 | } | 69 | } |
70 | down(&s2250_dev_table_mutex); | 70 | mutex_lock(&s2250_dev_table_mutex); |
71 | 71 | ||
72 | for (minor = 0; minor < MAX_DEVICES; minor++) { | 72 | for (minor = 0; minor < MAX_DEVICES; minor++) { |
73 | if (s2250_dev_table[minor] == NULL) | 73 | if (s2250_dev_table[minor] == NULL) |
@@ -96,7 +96,7 @@ static int s2250loader_probe(struct usb_interface *interface, | |||
96 | 96 | ||
97 | kref_init(&(s->kref)); | 97 | kref_init(&(s->kref)); |
98 | 98 | ||
99 | up(&s2250_dev_table_mutex); | 99 | mutex_unlock(&s2250_dev_table_mutex); |
100 | 100 | ||
101 | if (request_firmware(&fw, S2250_LOADER_FIRMWARE, &usbdev->dev)) { | 101 | if (request_firmware(&fw, S2250_LOADER_FIRMWARE, &usbdev->dev)) { |
102 | printk(KERN_ERR | 102 | printk(KERN_ERR |
@@ -128,7 +128,7 @@ static int s2250loader_probe(struct usb_interface *interface, | |||
128 | return 0; | 128 | return 0; |
129 | 129 | ||
130 | failed: | 130 | failed: |
131 | up(&s2250_dev_table_mutex); | 131 | mutex_unlock(&s2250_dev_table_mutex); |
132 | failed2: | 132 | failed2: |
133 | if (s) | 133 | if (s) |
134 | kref_put(&(s->kref), s2250loader_delete); | 134 | kref_put(&(s->kref), s2250loader_delete); |
diff --git a/drivers/staging/go7007/snd-go7007.c b/drivers/staging/go7007/snd-go7007.c index cd19be6c00e0..03c4dfc138a1 100644 --- a/drivers/staging/go7007/snd-go7007.c +++ b/drivers/staging/go7007/snd-go7007.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/time.h> | 26 | #include <linux/time.h> |
27 | #include <linux/mm.h> | 27 | #include <linux/mm.h> |
28 | #include <linux/i2c.h> | 28 | #include <linux/i2c.h> |
29 | #include <linux/semaphore.h> | 29 | #include <linux/mutex.h> |
30 | #include <linux/uaccess.h> | 30 | #include <linux/uaccess.h> |
31 | #include <asm/system.h> | 31 | #include <asm/system.h> |
32 | #include <sound/core.h> | 32 | #include <sound/core.h> |