diff options
-rw-r--r-- | drivers/media/video/adv7170.c | 17 | ||||
-rw-r--r-- | drivers/media/video/adv7175.c | 51 | ||||
-rw-r--r-- | drivers/media/video/bt819.c | 17 | ||||
-rw-r--r-- | drivers/media/video/bt856.c | 13 | ||||
-rw-r--r-- | drivers/media/video/cpia.c | 2 | ||||
-rw-r--r-- | drivers/media/video/saa7110.c | 19 | ||||
-rw-r--r-- | drivers/media/video/saa7111.c | 26 | ||||
-rw-r--r-- | drivers/media/video/saa7114.c | 23 | ||||
-rw-r--r-- | drivers/media/video/saa7185.c | 17 | ||||
-rw-r--r-- | drivers/media/video/zoran.h | 2 | ||||
-rw-r--r-- | drivers/media/video/zoran_card.c | 49 | ||||
-rw-r--r-- | drivers/media/video/zoran_driver.c | 227 |
12 files changed, 200 insertions, 263 deletions
diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c index 6e2004cdec1f..671e36db224d 100644 --- a/drivers/media/video/adv7170.c +++ b/drivers/media/video/adv7170.c | |||
@@ -124,24 +124,21 @@ adv7170_write_block (struct i2c_client *client, | |||
124 | if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { | 124 | if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { |
125 | /* do raw I2C, not smbus compatible */ | 125 | /* do raw I2C, not smbus compatible */ |
126 | struct adv7170 *encoder = i2c_get_clientdata(client); | 126 | struct adv7170 *encoder = i2c_get_clientdata(client); |
127 | struct i2c_msg msg; | ||
128 | u8 block_data[32]; | 127 | u8 block_data[32]; |
128 | int block_len; | ||
129 | 129 | ||
130 | msg.addr = client->addr; | ||
131 | msg.flags = 0; | ||
132 | while (len >= 2) { | 130 | while (len >= 2) { |
133 | msg.buf = (char *) block_data; | 131 | block_len = 0; |
134 | msg.len = 0; | 132 | block_data[block_len++] = reg = data[0]; |
135 | block_data[msg.len++] = reg = data[0]; | ||
136 | do { | 133 | do { |
137 | block_data[msg.len++] = | 134 | block_data[block_len++] = |
138 | encoder->reg[reg++] = data[1]; | 135 | encoder->reg[reg++] = data[1]; |
139 | len -= 2; | 136 | len -= 2; |
140 | data += 2; | 137 | data += 2; |
141 | } while (len >= 2 && data[0] == reg && | 138 | } while (len >= 2 && data[0] == reg && |
142 | msg.len < 32); | 139 | block_len < 32); |
143 | if ((ret = i2c_transfer(client->adapter, | 140 | if ((ret = i2c_master_send(client, block_data, |
144 | &msg, 1)) < 0) | 141 | block_len)) < 0) |
145 | break; | 142 | break; |
146 | } | 143 | } |
147 | } else { | 144 | } else { |
diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c index 6b17247adf87..085e8863cacb 100644 --- a/drivers/media/video/adv7175.c +++ b/drivers/media/video/adv7175.c | |||
@@ -67,8 +67,6 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)"); | |||
67 | /* ----------------------------------------------------------------------- */ | 67 | /* ----------------------------------------------------------------------- */ |
68 | 68 | ||
69 | struct adv7175 { | 69 | struct adv7175 { |
70 | unsigned char reg[128]; | ||
71 | |||
72 | int norm; | 70 | int norm; |
73 | int input; | 71 | int input; |
74 | int enable; | 72 | int enable; |
@@ -94,9 +92,6 @@ adv7175_write (struct i2c_client *client, | |||
94 | u8 reg, | 92 | u8 reg, |
95 | u8 value) | 93 | u8 value) |
96 | { | 94 | { |
97 | struct adv7175 *encoder = i2c_get_clientdata(client); | ||
98 | |||
99 | encoder->reg[reg] = value; | ||
100 | return i2c_smbus_write_byte_data(client, reg, value); | 95 | return i2c_smbus_write_byte_data(client, reg, value); |
101 | } | 96 | } |
102 | 97 | ||
@@ -119,25 +114,21 @@ adv7175_write_block (struct i2c_client *client, | |||
119 | * the adapter understands raw I2C */ | 114 | * the adapter understands raw I2C */ |
120 | if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { | 115 | if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { |
121 | /* do raw I2C, not smbus compatible */ | 116 | /* do raw I2C, not smbus compatible */ |
122 | struct adv7175 *encoder = i2c_get_clientdata(client); | ||
123 | struct i2c_msg msg; | ||
124 | u8 block_data[32]; | 117 | u8 block_data[32]; |
118 | int block_len; | ||
125 | 119 | ||
126 | msg.addr = client->addr; | ||
127 | msg.flags = 0; | ||
128 | while (len >= 2) { | 120 | while (len >= 2) { |
129 | msg.buf = (char *) block_data; | 121 | block_len = 0; |
130 | msg.len = 0; | 122 | block_data[block_len++] = reg = data[0]; |
131 | block_data[msg.len++] = reg = data[0]; | ||
132 | do { | 123 | do { |
133 | block_data[msg.len++] = | 124 | block_data[block_len++] = data[1]; |
134 | encoder->reg[reg++] = data[1]; | 125 | reg++; |
135 | len -= 2; | 126 | len -= 2; |
136 | data += 2; | 127 | data += 2; |
137 | } while (len >= 2 && data[0] == reg && | 128 | } while (len >= 2 && data[0] == reg && |
138 | msg.len < 32); | 129 | block_len < 32); |
139 | if ((ret = i2c_transfer(client->adapter, | 130 | if ((ret = i2c_master_send(client, block_data, |
140 | &msg, 1)) < 0) | 131 | block_len)) < 0) |
141 | break; | 132 | break; |
142 | } | 133 | } |
143 | } else { | 134 | } else { |
@@ -170,24 +161,6 @@ set_subcarrier_freq (struct i2c_client *client, | |||
170 | adv7175_write(client, 0x05, 0x25); | 161 | adv7175_write(client, 0x05, 0x25); |
171 | } | 162 | } |
172 | 163 | ||
173 | #ifdef ENCODER_DUMP | ||
174 | static void | ||
175 | dump (struct i2c_client *client) | ||
176 | { | ||
177 | struct adv7175 *encoder = i2c_get_clientdata(client); | ||
178 | int i, j; | ||
179 | |||
180 | printk(KERN_INFO "%s: registry dump\n", I2C_NAME(client)); | ||
181 | for (i = 0; i < 182 / 8; i++) { | ||
182 | printk("%s: 0x%02x -", I2C_NAME(client), i * 8); | ||
183 | for (j = 0; j < 8; j++) { | ||
184 | printk(" 0x%02x", encoder->reg[i * 8 + j]); | ||
185 | } | ||
186 | printk("\n"); | ||
187 | } | ||
188 | } | ||
189 | #endif | ||
190 | |||
191 | /* ----------------------------------------------------------------------- */ | 164 | /* ----------------------------------------------------------------------- */ |
192 | // Output filter: S-Video Composite | 165 | // Output filter: S-Video Composite |
193 | 166 | ||
@@ -406,14 +379,6 @@ adv7175_command (struct i2c_client *client, | |||
406 | } | 379 | } |
407 | break; | 380 | break; |
408 | 381 | ||
409 | #ifdef ENCODER_DUMP | ||
410 | case ENCODER_DUMP: | ||
411 | { | ||
412 | dump(client); | ||
413 | } | ||
414 | break; | ||
415 | #endif | ||
416 | |||
417 | default: | 382 | default: |
418 | return -EINVAL; | 383 | return -EINVAL; |
419 | } | 384 | } |
diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c index 2bf63e7ab4e6..d8a18a6a5bee 100644 --- a/drivers/media/video/bt819.c +++ b/drivers/media/video/bt819.c | |||
@@ -140,24 +140,21 @@ bt819_write_block (struct i2c_client *client, | |||
140 | if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { | 140 | if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { |
141 | /* do raw I2C, not smbus compatible */ | 141 | /* do raw I2C, not smbus compatible */ |
142 | struct bt819 *decoder = i2c_get_clientdata(client); | 142 | struct bt819 *decoder = i2c_get_clientdata(client); |
143 | struct i2c_msg msg; | ||
144 | u8 block_data[32]; | 143 | u8 block_data[32]; |
144 | int block_len; | ||
145 | 145 | ||
146 | msg.addr = client->addr; | ||
147 | msg.flags = 0; | ||
148 | while (len >= 2) { | 146 | while (len >= 2) { |
149 | msg.buf = (char *) block_data; | 147 | block_len = 0; |
150 | msg.len = 0; | 148 | block_data[block_len++] = reg = data[0]; |
151 | block_data[msg.len++] = reg = data[0]; | ||
152 | do { | 149 | do { |
153 | block_data[msg.len++] = | 150 | block_data[block_len++] = |
154 | decoder->reg[reg++] = data[1]; | 151 | decoder->reg[reg++] = data[1]; |
155 | len -= 2; | 152 | len -= 2; |
156 | data += 2; | 153 | data += 2; |
157 | } while (len >= 2 && data[0] == reg && | 154 | } while (len >= 2 && data[0] == reg && |
158 | msg.len < 32); | 155 | block_len < 32); |
159 | if ((ret = i2c_transfer(client->adapter, | 156 | if ((ret = i2c_master_send(client, block_data, |
160 | &msg, 1)) < 0) | 157 | block_len)) < 0) |
161 | break; | 158 | break; |
162 | } | 159 | } |
163 | } else { | 160 | } else { |
diff --git a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c index da3be00ae2fb..4d47a0a0e974 100644 --- a/drivers/media/video/bt856.c +++ b/drivers/media/video/bt856.c | |||
@@ -70,17 +70,14 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)"); | |||
70 | 70 | ||
71 | /* ----------------------------------------------------------------------- */ | 71 | /* ----------------------------------------------------------------------- */ |
72 | 72 | ||
73 | #define REG_OFFSET 0xCE | 73 | #define REG_OFFSET 0xDA |
74 | #define BT856_NR_REG 6 | ||
74 | 75 | ||
75 | struct bt856 { | 76 | struct bt856 { |
76 | unsigned char reg[32]; | 77 | unsigned char reg[BT856_NR_REG]; |
77 | 78 | ||
78 | int norm; | 79 | int norm; |
79 | int enable; | 80 | int enable; |
80 | int bright; | ||
81 | int contrast; | ||
82 | int hue; | ||
83 | int sat; | ||
84 | }; | 81 | }; |
85 | 82 | ||
86 | #define I2C_BT856 0x88 | 83 | #define I2C_BT856 0x88 |
@@ -119,8 +116,8 @@ bt856_dump (struct i2c_client *client) | |||
119 | struct bt856 *encoder = i2c_get_clientdata(client); | 116 | struct bt856 *encoder = i2c_get_clientdata(client); |
120 | 117 | ||
121 | printk(KERN_INFO "%s: register dump:", I2C_NAME(client)); | 118 | printk(KERN_INFO "%s: register dump:", I2C_NAME(client)); |
122 | for (i = 0xd6; i <= 0xde; i += 2) | 119 | for (i = 0; i < BT856_NR_REG; i += 2) |
123 | printk(" %02x", encoder->reg[i - REG_OFFSET]); | 120 | printk(" %02x", encoder->reg[i]); |
124 | printk("\n"); | 121 | printk("\n"); |
125 | } | 122 | } |
126 | 123 | ||
diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c index d93a561e6b80..3cebfa91ca14 100644 --- a/drivers/media/video/cpia.c +++ b/drivers/media/video/cpia.c | |||
@@ -58,7 +58,7 @@ static int video_nr = -1; | |||
58 | 58 | ||
59 | #ifdef MODULE | 59 | #ifdef MODULE |
60 | module_param(video_nr, int, 0); | 60 | module_param(video_nr, int, 0); |
61 | MODULE_AUTHOR("Scott J. Bertin <sbertin@securenym.net> & Peter Pregler <Peter_Pregler@email.com> & Johannes Erdfelt <johannes@erdfeld.com>"); | 61 | MODULE_AUTHOR("Scott J. Bertin <sbertin@securenym.net> & Peter Pregler <Peter_Pregler@email.com> & Johannes Erdfelt <johannes@erdfelt.com>"); |
62 | MODULE_DESCRIPTION("V4L-driver for Vision CPiA based cameras"); | 62 | MODULE_DESCRIPTION("V4L-driver for Vision CPiA based cameras"); |
63 | MODULE_LICENSE("GPL"); | 63 | MODULE_LICENSE("GPL"); |
64 | MODULE_SUPPORTED_DEVICE("video"); | 64 | MODULE_SUPPORTED_DEVICE("video"); |
diff --git a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c index dff06895171b..e18ea268384b 100644 --- a/drivers/media/video/saa7110.c +++ b/drivers/media/video/saa7110.c | |||
@@ -107,13 +107,8 @@ saa7110_write_block (struct i2c_client *client, | |||
107 | * the adapter understands raw I2C */ | 107 | * the adapter understands raw I2C */ |
108 | if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { | 108 | if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { |
109 | struct saa7110 *decoder = i2c_get_clientdata(client); | 109 | struct saa7110 *decoder = i2c_get_clientdata(client); |
110 | struct i2c_msg msg; | ||
111 | 110 | ||
112 | msg.len = len; | 111 | ret = i2c_master_send(client, data, len); |
113 | msg.buf = (char *) data; | ||
114 | msg.addr = client->addr; | ||
115 | msg.flags = 0; | ||
116 | ret = i2c_transfer(client->adapter, &msg, 1); | ||
117 | 112 | ||
118 | /* Cache the written data */ | 113 | /* Cache the written data */ |
119 | memcpy(decoder->reg + reg, data + 1, len - 1); | 114 | memcpy(decoder->reg + reg, data + 1, len - 1); |
@@ -431,15 +426,13 @@ saa7110_command (struct i2c_client *client, | |||
431 | break; | 426 | break; |
432 | 427 | ||
433 | case DECODER_DUMP: | 428 | case DECODER_DUMP: |
434 | for (v = 0; v < 0x34; v += 16) { | 429 | for (v = 0; v < SAA7110_NR_REG; v += 16) { |
435 | int j; | 430 | int j; |
436 | dprintk(1, KERN_INFO "%s: %03x\n", I2C_NAME(client), | 431 | dprintk(1, KERN_DEBUG "%s: %02x:", I2C_NAME(client), |
437 | v); | 432 | v); |
438 | for (j = 0; j < 16; j++) { | 433 | for (j = 0; j < 16 && v + j < SAA7110_NR_REG; j++) |
439 | dprintk(1, KERN_INFO " %02x", | 434 | dprintk(1, " %02x", decoder->reg[v + j]); |
440 | decoder->reg[v + j]); | 435 | dprintk(1, "\n"); |
441 | } | ||
442 | dprintk(1, KERN_INFO "\n"); | ||
443 | } | 436 | } |
444 | break; | 437 | break; |
445 | 438 | ||
diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c index 5e06cc98442d..f9ba0c943adf 100644 --- a/drivers/media/video/saa7111.c +++ b/drivers/media/video/saa7111.c | |||
@@ -69,8 +69,10 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)"); | |||
69 | 69 | ||
70 | /* ----------------------------------------------------------------------- */ | 70 | /* ----------------------------------------------------------------------- */ |
71 | 71 | ||
72 | #define SAA7111_NR_REG 0x18 | ||
73 | |||
72 | struct saa7111 { | 74 | struct saa7111 { |
73 | unsigned char reg[32]; | 75 | unsigned char reg[SAA7111_NR_REG]; |
74 | 76 | ||
75 | int norm; | 77 | int norm; |
76 | int input; | 78 | int input; |
@@ -109,24 +111,21 @@ saa7111_write_block (struct i2c_client *client, | |||
109 | if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { | 111 | if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { |
110 | /* do raw I2C, not smbus compatible */ | 112 | /* do raw I2C, not smbus compatible */ |
111 | struct saa7111 *decoder = i2c_get_clientdata(client); | 113 | struct saa7111 *decoder = i2c_get_clientdata(client); |
112 | struct i2c_msg msg; | ||
113 | u8 block_data[32]; | 114 | u8 block_data[32]; |
115 | int block_len; | ||
114 | 116 | ||
115 | msg.addr = client->addr; | ||
116 | msg.flags = 0; | ||
117 | while (len >= 2) { | 117 | while (len >= 2) { |
118 | msg.buf = (char *) block_data; | 118 | block_len = 0; |
119 | msg.len = 0; | 119 | block_data[block_len++] = reg = data[0]; |
120 | block_data[msg.len++] = reg = data[0]; | ||
121 | do { | 120 | do { |
122 | block_data[msg.len++] = | 121 | block_data[block_len++] = |
123 | decoder->reg[reg++] = data[1]; | 122 | decoder->reg[reg++] = data[1]; |
124 | len -= 2; | 123 | len -= 2; |
125 | data += 2; | 124 | data += 2; |
126 | } while (len >= 2 && data[0] == reg && | 125 | } while (len >= 2 && data[0] == reg && |
127 | msg.len < 32); | 126 | block_len < 32); |
128 | if ((ret = i2c_transfer(client->adapter, | 127 | if ((ret = i2c_master_send(client, block_data, |
129 | &msg, 1)) < 0) | 128 | block_len)) < 0) |
130 | break; | 129 | break; |
131 | } | 130 | } |
132 | } else { | 131 | } else { |
@@ -209,6 +208,7 @@ saa7111_command (struct i2c_client *client, | |||
209 | switch (cmd) { | 208 | switch (cmd) { |
210 | 209 | ||
211 | case 0: | 210 | case 0: |
211 | break; | ||
212 | case DECODER_INIT: | 212 | case DECODER_INIT: |
213 | { | 213 | { |
214 | struct video_decoder_init *init = arg; | 214 | struct video_decoder_init *init = arg; |
@@ -226,11 +226,11 @@ saa7111_command (struct i2c_client *client, | |||
226 | { | 226 | { |
227 | int i; | 227 | int i; |
228 | 228 | ||
229 | for (i = 0; i < 32; i += 16) { | 229 | for (i = 0; i < SAA7111_NR_REG; i += 16) { |
230 | int j; | 230 | int j; |
231 | 231 | ||
232 | printk(KERN_DEBUG "%s: %03x", I2C_NAME(client), i); | 232 | printk(KERN_DEBUG "%s: %03x", I2C_NAME(client), i); |
233 | for (j = 0; j < 16; ++j) { | 233 | for (j = 0; j < 16 && i + j < SAA7111_NR_REG; ++j) { |
234 | printk(" %02x", | 234 | printk(" %02x", |
235 | saa7111_read(client, i + j)); | 235 | saa7111_read(client, i + j)); |
236 | } | 236 | } |
diff --git a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c index ce5a740e923e..4a1f841d0c77 100644 --- a/drivers/media/video/saa7114.c +++ b/drivers/media/video/saa7114.c | |||
@@ -138,9 +138,6 @@ saa7114_write (struct i2c_client *client, | |||
138 | u8 reg, | 138 | u8 reg, |
139 | u8 value) | 139 | u8 value) |
140 | { | 140 | { |
141 | /*struct saa7114 *decoder = i2c_get_clientdata(client);*/ | ||
142 | |||
143 | /*decoder->reg[reg] = value;*/ | ||
144 | return i2c_smbus_write_byte_data(client, reg, value); | 141 | return i2c_smbus_write_byte_data(client, reg, value); |
145 | } | 142 | } |
146 | 143 | ||
@@ -156,25 +153,21 @@ saa7114_write_block (struct i2c_client *client, | |||
156 | * the adapter understands raw I2C */ | 153 | * the adapter understands raw I2C */ |
157 | if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { | 154 | if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { |
158 | /* do raw I2C, not smbus compatible */ | 155 | /* do raw I2C, not smbus compatible */ |
159 | /*struct saa7114 *decoder = i2c_get_clientdata(client);*/ | ||
160 | struct i2c_msg msg; | ||
161 | u8 block_data[32]; | 156 | u8 block_data[32]; |
157 | int block_len; | ||
162 | 158 | ||
163 | msg.addr = client->addr; | ||
164 | msg.flags = 0; | ||
165 | while (len >= 2) { | 159 | while (len >= 2) { |
166 | msg.buf = (char *) block_data; | 160 | block_len = 0; |
167 | msg.len = 0; | 161 | block_data[block_len++] = reg = data[0]; |
168 | block_data[msg.len++] = reg = data[0]; | ||
169 | do { | 162 | do { |
170 | block_data[msg.len++] = | 163 | block_data[block_len++] = data[1]; |
171 | /*decoder->reg[reg++] =*/ data[1]; | 164 | reg++; |
172 | len -= 2; | 165 | len -= 2; |
173 | data += 2; | 166 | data += 2; |
174 | } while (len >= 2 && data[0] == reg && | 167 | } while (len >= 2 && data[0] == reg && |
175 | msg.len < 32); | 168 | block_len < 32); |
176 | if ((ret = i2c_transfer(client->adapter, | 169 | if ((ret = i2c_master_send(client, block_data, |
177 | &msg, 1)) < 0) | 170 | block_len)) < 0) |
178 | break; | 171 | break; |
179 | } | 172 | } |
180 | } else { | 173 | } else { |
diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c index e1718e85f6c4..9f99ee1303e0 100644 --- a/drivers/media/video/saa7185.c +++ b/drivers/media/video/saa7185.c | |||
@@ -112,24 +112,21 @@ saa7185_write_block (struct i2c_client *client, | |||
112 | if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { | 112 | if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { |
113 | /* do raw I2C, not smbus compatible */ | 113 | /* do raw I2C, not smbus compatible */ |
114 | struct saa7185 *encoder = i2c_get_clientdata(client); | 114 | struct saa7185 *encoder = i2c_get_clientdata(client); |
115 | struct i2c_msg msg; | ||
116 | u8 block_data[32]; | 115 | u8 block_data[32]; |
116 | int block_len; | ||
117 | 117 | ||
118 | msg.addr = client->addr; | ||
119 | msg.flags = 0; | ||
120 | while (len >= 2) { | 118 | while (len >= 2) { |
121 | msg.buf = (char *) block_data; | 119 | block_len = 0; |
122 | msg.len = 0; | 120 | block_data[block_len++] = reg = data[0]; |
123 | block_data[msg.len++] = reg = data[0]; | ||
124 | do { | 121 | do { |
125 | block_data[msg.len++] = | 122 | block_data[block_len++] = |
126 | encoder->reg[reg++] = data[1]; | 123 | encoder->reg[reg++] = data[1]; |
127 | len -= 2; | 124 | len -= 2; |
128 | data += 2; | 125 | data += 2; |
129 | } while (len >= 2 && data[0] == reg && | 126 | } while (len >= 2 && data[0] == reg && |
130 | msg.len < 32); | 127 | block_len < 32); |
131 | if ((ret = i2c_transfer(client->adapter, | 128 | if ((ret = i2c_master_send(client, block_data, |
132 | &msg, 1)) < 0) | 129 | block_len)) < 0) |
133 | break; | 130 | break; |
134 | } | 131 | } |
135 | } else { | 132 | } else { |
diff --git a/drivers/media/video/zoran.h b/drivers/media/video/zoran.h index 9fe6ad3b6352..ad04a129499d 100644 --- a/drivers/media/video/zoran.h +++ b/drivers/media/video/zoran.h | |||
@@ -395,7 +395,7 @@ struct zoran { | |||
395 | struct videocodec *codec; /* video codec */ | 395 | struct videocodec *codec; /* video codec */ |
396 | struct videocodec *vfe; /* video front end */ | 396 | struct videocodec *vfe; /* video front end */ |
397 | 397 | ||
398 | struct semaphore resource_lock; /* prevent evil stuff */ | 398 | struct mutex resource_lock; /* prevent evil stuff */ |
399 | 399 | ||
400 | u8 initialized; /* flag if zoran has been correctly initalized */ | 400 | u8 initialized; /* flag if zoran has been correctly initalized */ |
401 | int user; /* number of current users */ | 401 | int user; /* number of current users */ |
diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c index 246e67cd8b51..b22dbb6d18f6 100644 --- a/drivers/media/video/zoran_card.c +++ b/drivers/media/video/zoran_card.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/interrupt.h> | 47 | #include <linux/interrupt.h> |
48 | #include <linux/video_decoder.h> | 48 | #include <linux/video_decoder.h> |
49 | #include <linux/video_encoder.h> | 49 | #include <linux/video_encoder.h> |
50 | #include <linux/mutex.h> | ||
50 | 51 | ||
51 | #include <asm/io.h> | 52 | #include <asm/io.h> |
52 | 53 | ||
@@ -673,7 +674,7 @@ zoran_i2c_client_register (struct i2c_client *client) | |||
673 | KERN_DEBUG "%s: i2c_client_register() - driver id = %d\n", | 674 | KERN_DEBUG "%s: i2c_client_register() - driver id = %d\n", |
674 | ZR_DEVNAME(zr), client->driver->id); | 675 | ZR_DEVNAME(zr), client->driver->id); |
675 | 676 | ||
676 | down(&zr->resource_lock); | 677 | mutex_lock(&zr->resource_lock); |
677 | 678 | ||
678 | if (zr->user > 0) { | 679 | if (zr->user > 0) { |
679 | /* we're already busy, so we keep a reference to | 680 | /* we're already busy, so we keep a reference to |
@@ -694,7 +695,7 @@ zoran_i2c_client_register (struct i2c_client *client) | |||
694 | } | 695 | } |
695 | 696 | ||
696 | clientreg_unlock_and_return: | 697 | clientreg_unlock_and_return: |
697 | up(&zr->resource_lock); | 698 | mutex_unlock(&zr->resource_lock); |
698 | 699 | ||
699 | return res; | 700 | return res; |
700 | } | 701 | } |
@@ -707,7 +708,7 @@ zoran_i2c_client_unregister (struct i2c_client *client) | |||
707 | 708 | ||
708 | dprintk(2, KERN_DEBUG "%s: i2c_client_unregister()\n", ZR_DEVNAME(zr)); | 709 | dprintk(2, KERN_DEBUG "%s: i2c_client_unregister()\n", ZR_DEVNAME(zr)); |
709 | 710 | ||
710 | down(&zr->resource_lock); | 711 | mutex_lock(&zr->resource_lock); |
711 | 712 | ||
712 | if (zr->user > 0) { | 713 | if (zr->user > 0) { |
713 | res = -EBUSY; | 714 | res = -EBUSY; |
@@ -722,7 +723,7 @@ zoran_i2c_client_unregister (struct i2c_client *client) | |||
722 | snprintf(ZR_DEVNAME(zr), sizeof(ZR_DEVNAME(zr)), "MJPEG[%d]", zr->id); | 723 | snprintf(ZR_DEVNAME(zr), sizeof(ZR_DEVNAME(zr)), "MJPEG[%d]", zr->id); |
723 | } | 724 | } |
724 | clientunreg_unlock_and_return: | 725 | clientunreg_unlock_and_return: |
725 | up(&zr->resource_lock); | 726 | mutex_unlock(&zr->resource_lock); |
726 | return res; | 727 | return res; |
727 | } | 728 | } |
728 | 729 | ||
@@ -995,10 +996,7 @@ test_interrupts (struct zoran *zr) | |||
995 | static int __devinit | 996 | static int __devinit |
996 | zr36057_init (struct zoran *zr) | 997 | zr36057_init (struct zoran *zr) |
997 | { | 998 | { |
998 | u32 *mem; | 999 | int j, err; |
999 | void *vdev; | ||
1000 | unsigned mem_needed; | ||
1001 | int j; | ||
1002 | int two = 2; | 1000 | int two = 2; |
1003 | int zero = 0; | 1001 | int zero = 0; |
1004 | 1002 | ||
@@ -1049,19 +1047,16 @@ zr36057_init (struct zoran *zr) | |||
1049 | 1047 | ||
1050 | /* allocate memory *before* doing anything to the hardware | 1048 | /* allocate memory *before* doing anything to the hardware |
1051 | * in case allocation fails */ | 1049 | * in case allocation fails */ |
1052 | mem_needed = BUZ_NUM_STAT_COM * 4; | 1050 | zr->stat_com = kzalloc(BUZ_NUM_STAT_COM * 4, GFP_KERNEL); |
1053 | mem = kzalloc(mem_needed, GFP_KERNEL); | 1051 | zr->video_dev = kmalloc(sizeof(struct video_device), GFP_KERNEL); |
1054 | vdev = (void *) kmalloc(sizeof(struct video_device), GFP_KERNEL); | 1052 | if (!zr->stat_com || !zr->video_dev) { |
1055 | if (!mem || !vdev) { | ||
1056 | dprintk(1, | 1053 | dprintk(1, |
1057 | KERN_ERR | 1054 | KERN_ERR |
1058 | "%s: zr36057_init() - kmalloc (STAT_COM) failed\n", | 1055 | "%s: zr36057_init() - kmalloc (STAT_COM) failed\n", |
1059 | ZR_DEVNAME(zr)); | 1056 | ZR_DEVNAME(zr)); |
1060 | kfree(vdev); | 1057 | err = -ENOMEM; |
1061 | kfree(mem); | 1058 | goto exit_free; |
1062 | return -ENOMEM; | ||
1063 | } | 1059 | } |
1064 | zr->stat_com = mem; | ||
1065 | for (j = 0; j < BUZ_NUM_STAT_COM; j++) { | 1060 | for (j = 0; j < BUZ_NUM_STAT_COM; j++) { |
1066 | zr->stat_com[j] = 1; /* mark as unavailable to zr36057 */ | 1061 | zr->stat_com[j] = 1; /* mark as unavailable to zr36057 */ |
1067 | } | 1062 | } |
@@ -1069,16 +1064,11 @@ zr36057_init (struct zoran *zr) | |||
1069 | /* | 1064 | /* |
1070 | * Now add the template and register the device unit. | 1065 | * Now add the template and register the device unit. |
1071 | */ | 1066 | */ |
1072 | zr->video_dev = vdev; | ||
1073 | memcpy(zr->video_dev, &zoran_template, sizeof(zoran_template)); | 1067 | memcpy(zr->video_dev, &zoran_template, sizeof(zoran_template)); |
1074 | strcpy(zr->video_dev->name, ZR_DEVNAME(zr)); | 1068 | strcpy(zr->video_dev->name, ZR_DEVNAME(zr)); |
1075 | if (video_register_device(zr->video_dev, VFL_TYPE_GRABBER, | 1069 | err = video_register_device(zr->video_dev, VFL_TYPE_GRABBER, video_nr); |
1076 | video_nr) < 0) { | 1070 | if (err < 0) |
1077 | zoran_unregister_i2c(zr); | 1071 | goto exit_unregister; |
1078 | kfree((void *) zr->stat_com); | ||
1079 | kfree(vdev); | ||
1080 | return -1; | ||
1081 | } | ||
1082 | 1072 | ||
1083 | zoran_init_hardware(zr); | 1073 | zoran_init_hardware(zr); |
1084 | if (*zr_debug > 2) | 1074 | if (*zr_debug > 2) |
@@ -1092,6 +1082,13 @@ zr36057_init (struct zoran *zr) | |||
1092 | zr->zoran_proc = NULL; | 1082 | zr->zoran_proc = NULL; |
1093 | zr->initialized = 1; | 1083 | zr->initialized = 1; |
1094 | return 0; | 1084 | return 0; |
1085 | |||
1086 | exit_unregister: | ||
1087 | zoran_unregister_i2c(zr); | ||
1088 | exit_free: | ||
1089 | kfree(zr->stat_com); | ||
1090 | kfree(zr->video_dev); | ||
1091 | return err; | ||
1095 | } | 1092 | } |
1096 | 1093 | ||
1097 | static void | 1094 | static void |
@@ -1121,7 +1118,7 @@ zoran_release (struct zoran *zr) | |||
1121 | btwrite(0, ZR36057_SPGPPCR); | 1118 | btwrite(0, ZR36057_SPGPPCR); |
1122 | free_irq(zr->pci_dev->irq, zr); | 1119 | free_irq(zr->pci_dev->irq, zr); |
1123 | /* unmap and free memory */ | 1120 | /* unmap and free memory */ |
1124 | kfree((void *) zr->stat_com); | 1121 | kfree(zr->stat_com); |
1125 | zoran_proc_cleanup(zr); | 1122 | zoran_proc_cleanup(zr); |
1126 | iounmap(zr->zr36057_mem); | 1123 | iounmap(zr->zr36057_mem); |
1127 | pci_disable_device(zr->pci_dev); | 1124 | pci_disable_device(zr->pci_dev); |
@@ -1206,7 +1203,7 @@ find_zr36057 (void) | |||
1206 | zr->id = zoran_num; | 1203 | zr->id = zoran_num; |
1207 | snprintf(ZR_DEVNAME(zr), sizeof(ZR_DEVNAME(zr)), "MJPEG[%u]", zr->id); | 1204 | snprintf(ZR_DEVNAME(zr), sizeof(ZR_DEVNAME(zr)), "MJPEG[%u]", zr->id); |
1208 | spin_lock_init(&zr->spinlock); | 1205 | spin_lock_init(&zr->spinlock); |
1209 | init_MUTEX(&zr->resource_lock); | 1206 | mutex_init(&zr->resource_lock); |
1210 | if (pci_enable_device(dev)) | 1207 | if (pci_enable_device(dev)) |
1211 | continue; | 1208 | continue; |
1212 | zr->zr36057_adr = pci_resource_start(zr->pci_dev, 0); | 1209 | zr->zr36057_adr = pci_resource_start(zr->pci_dev, 0); |
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index 485553be190b..b2c6e01e3923 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c | |||
@@ -81,6 +81,7 @@ | |||
81 | 81 | ||
82 | #include <linux/video_decoder.h> | 82 | #include <linux/video_decoder.h> |
83 | #include <linux/video_encoder.h> | 83 | #include <linux/video_encoder.h> |
84 | #include <linux/mutex.h> | ||
84 | #include "zoran.h" | 85 | #include "zoran.h" |
85 | #include "zoran_device.h" | 86 | #include "zoran_device.h" |
86 | #include "zoran_card.h" | 87 | #include "zoran_card.h" |
@@ -1292,7 +1293,7 @@ zoran_open (struct inode *inode, | |||
1292 | 1293 | ||
1293 | /* see fs/device.c - the kernel already locks during open(), | 1294 | /* see fs/device.c - the kernel already locks during open(), |
1294 | * so locking ourselves only causes deadlocks */ | 1295 | * so locking ourselves only causes deadlocks */ |
1295 | /*down(&zr->resource_lock);*/ | 1296 | /*mutex_lock(&zr->resource_lock);*/ |
1296 | 1297 | ||
1297 | if (!zr->decoder) { | 1298 | if (!zr->decoder) { |
1298 | dprintk(1, | 1299 | dprintk(1, |
@@ -1371,7 +1372,7 @@ zoran_open (struct inode *inode, | |||
1371 | if (zr->user++ == 0) | 1372 | if (zr->user++ == 0) |
1372 | first_open = 1; | 1373 | first_open = 1; |
1373 | 1374 | ||
1374 | /*up(&zr->resource_lock);*/ | 1375 | /*mutex_unlock(&zr->resource_lock);*/ |
1375 | 1376 | ||
1376 | /* default setup - TODO: look at flags */ | 1377 | /* default setup - TODO: look at flags */ |
1377 | if (first_open) { /* First device open */ | 1378 | if (first_open) { /* First device open */ |
@@ -1401,7 +1402,7 @@ open_unlock_and_return: | |||
1401 | 1402 | ||
1402 | /* if there's no device found, we didn't obtain the lock either */ | 1403 | /* if there's no device found, we didn't obtain the lock either */ |
1403 | if (zr) { | 1404 | if (zr) { |
1404 | /*up(&zr->resource_lock);*/ | 1405 | /*mutex_unlock(&zr->resource_lock);*/ |
1405 | } | 1406 | } |
1406 | 1407 | ||
1407 | return res; | 1408 | return res; |
@@ -1419,7 +1420,7 @@ zoran_close (struct inode *inode, | |||
1419 | 1420 | ||
1420 | /* kernel locks (fs/device.c), so don't do that ourselves | 1421 | /* kernel locks (fs/device.c), so don't do that ourselves |
1421 | * (prevents deadlocks) */ | 1422 | * (prevents deadlocks) */ |
1422 | /*down(&zr->resource_lock);*/ | 1423 | /*mutex_lock(&zr->resource_lock);*/ |
1423 | 1424 | ||
1424 | zoran_close_end_session(file); | 1425 | zoran_close_end_session(file); |
1425 | 1426 | ||
@@ -1466,7 +1467,7 @@ zoran_close (struct inode *inode, | |||
1466 | } | 1467 | } |
1467 | module_put(THIS_MODULE); | 1468 | module_put(THIS_MODULE); |
1468 | 1469 | ||
1469 | /*up(&zr->resource_lock);*/ | 1470 | /*mutex_unlock(&zr->resource_lock);*/ |
1470 | 1471 | ||
1471 | dprintk(4, KERN_INFO "%s: zoran_close() done\n", ZR_DEVNAME(zr)); | 1472 | dprintk(4, KERN_INFO "%s: zoran_close() done\n", ZR_DEVNAME(zr)); |
1472 | 1473 | ||
@@ -2027,14 +2028,14 @@ zoran_do_ioctl (struct inode *inode, | |||
2027 | * but moving the free code outside the munmap() handler fixes | 2028 | * but moving the free code outside the munmap() handler fixes |
2028 | * all this... If someone knows why, please explain me (Ronald) | 2029 | * all this... If someone knows why, please explain me (Ronald) |
2029 | */ | 2030 | */ |
2030 | if (!down_trylock(&zr->resource_lock)) { | 2031 | if (!!mutex_trylock(&zr->resource_lock)) { |
2031 | /* we obtained it! Let's try to free some things */ | 2032 | /* we obtained it! Let's try to free some things */ |
2032 | if (fh->jpg_buffers.ready_to_be_freed) | 2033 | if (fh->jpg_buffers.ready_to_be_freed) |
2033 | jpg_fbuffer_free(file); | 2034 | jpg_fbuffer_free(file); |
2034 | if (fh->v4l_buffers.ready_to_be_freed) | 2035 | if (fh->v4l_buffers.ready_to_be_freed) |
2035 | v4l_fbuffer_free(file); | 2036 | v4l_fbuffer_free(file); |
2036 | 2037 | ||
2037 | up(&zr->resource_lock); | 2038 | mutex_unlock(&zr->resource_lock); |
2038 | } | 2039 | } |
2039 | 2040 | ||
2040 | switch (cmd) { | 2041 | switch (cmd) { |
@@ -2051,12 +2052,12 @@ zoran_do_ioctl (struct inode *inode, | |||
2051 | 2052 | ||
2052 | vcap->channels = zr->card.inputs; | 2053 | vcap->channels = zr->card.inputs; |
2053 | vcap->audios = 0; | 2054 | vcap->audios = 0; |
2054 | down(&zr->resource_lock); | 2055 | mutex_lock(&zr->resource_lock); |
2055 | vcap->maxwidth = BUZ_MAX_WIDTH; | 2056 | vcap->maxwidth = BUZ_MAX_WIDTH; |
2056 | vcap->maxheight = BUZ_MAX_HEIGHT; | 2057 | vcap->maxheight = BUZ_MAX_HEIGHT; |
2057 | vcap->minwidth = BUZ_MIN_WIDTH; | 2058 | vcap->minwidth = BUZ_MIN_WIDTH; |
2058 | vcap->minheight = BUZ_MIN_HEIGHT; | 2059 | vcap->minheight = BUZ_MIN_HEIGHT; |
2059 | up(&zr->resource_lock); | 2060 | mutex_unlock(&zr->resource_lock); |
2060 | 2061 | ||
2061 | return 0; | 2062 | return 0; |
2062 | } | 2063 | } |
@@ -2084,9 +2085,9 @@ zoran_do_ioctl (struct inode *inode, | |||
2084 | vchan->tuners = 0; | 2085 | vchan->tuners = 0; |
2085 | vchan->flags = 0; | 2086 | vchan->flags = 0; |
2086 | vchan->type = VIDEO_TYPE_CAMERA; | 2087 | vchan->type = VIDEO_TYPE_CAMERA; |
2087 | down(&zr->resource_lock); | 2088 | mutex_lock(&zr->resource_lock); |
2088 | vchan->norm = zr->norm; | 2089 | vchan->norm = zr->norm; |
2089 | up(&zr->resource_lock); | 2090 | mutex_unlock(&zr->resource_lock); |
2090 | vchan->channel = channel; | 2091 | vchan->channel = channel; |
2091 | 2092 | ||
2092 | return 0; | 2093 | return 0; |
@@ -2113,7 +2114,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2113 | "%s: VIDIOCSCHAN - channel=%d, norm=%d\n", | 2114 | "%s: VIDIOCSCHAN - channel=%d, norm=%d\n", |
2114 | ZR_DEVNAME(zr), vchan->channel, vchan->norm); | 2115 | ZR_DEVNAME(zr), vchan->channel, vchan->norm); |
2115 | 2116 | ||
2116 | down(&zr->resource_lock); | 2117 | mutex_lock(&zr->resource_lock); |
2117 | if ((res = zoran_set_input(zr, vchan->channel))) | 2118 | if ((res = zoran_set_input(zr, vchan->channel))) |
2118 | goto schan_unlock_and_return; | 2119 | goto schan_unlock_and_return; |
2119 | if ((res = zoran_set_norm(zr, vchan->norm))) | 2120 | if ((res = zoran_set_norm(zr, vchan->norm))) |
@@ -2122,7 +2123,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2122 | /* Make sure the changes come into effect */ | 2123 | /* Make sure the changes come into effect */ |
2123 | res = wait_grab_pending(zr); | 2124 | res = wait_grab_pending(zr); |
2124 | schan_unlock_and_return: | 2125 | schan_unlock_and_return: |
2125 | up(&zr->resource_lock); | 2126 | mutex_unlock(&zr->resource_lock); |
2126 | return res; | 2127 | return res; |
2127 | } | 2128 | } |
2128 | break; | 2129 | break; |
@@ -2134,7 +2135,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2134 | dprintk(3, KERN_DEBUG "%s: VIDIOCGPICT\n", ZR_DEVNAME(zr)); | 2135 | dprintk(3, KERN_DEBUG "%s: VIDIOCGPICT\n", ZR_DEVNAME(zr)); |
2135 | 2136 | ||
2136 | memset(vpict, 0, sizeof(struct video_picture)); | 2137 | memset(vpict, 0, sizeof(struct video_picture)); |
2137 | down(&zr->resource_lock); | 2138 | mutex_lock(&zr->resource_lock); |
2138 | vpict->hue = zr->hue; | 2139 | vpict->hue = zr->hue; |
2139 | vpict->brightness = zr->brightness; | 2140 | vpict->brightness = zr->brightness; |
2140 | vpict->contrast = zr->contrast; | 2141 | vpict->contrast = zr->contrast; |
@@ -2145,7 +2146,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2145 | } else { | 2146 | } else { |
2146 | vpict->depth = 0; | 2147 | vpict->depth = 0; |
2147 | } | 2148 | } |
2148 | up(&zr->resource_lock); | 2149 | mutex_unlock(&zr->resource_lock); |
2149 | 2150 | ||
2150 | return 0; | 2151 | return 0; |
2151 | } | 2152 | } |
@@ -2180,7 +2181,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2180 | return -EINVAL; | 2181 | return -EINVAL; |
2181 | } | 2182 | } |
2182 | 2183 | ||
2183 | down(&zr->resource_lock); | 2184 | mutex_lock(&zr->resource_lock); |
2184 | 2185 | ||
2185 | decoder_command(zr, DECODER_SET_PICTURE, vpict); | 2186 | decoder_command(zr, DECODER_SET_PICTURE, vpict); |
2186 | 2187 | ||
@@ -2191,7 +2192,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2191 | 2192 | ||
2192 | fh->overlay_settings.format = &zoran_formats[i]; | 2193 | fh->overlay_settings.format = &zoran_formats[i]; |
2193 | 2194 | ||
2194 | up(&zr->resource_lock); | 2195 | mutex_unlock(&zr->resource_lock); |
2195 | 2196 | ||
2196 | return 0; | 2197 | return 0; |
2197 | } | 2198 | } |
@@ -2204,9 +2205,9 @@ zoran_do_ioctl (struct inode *inode, | |||
2204 | dprintk(3, KERN_DEBUG "%s: VIDIOCCAPTURE - on=%d\n", | 2205 | dprintk(3, KERN_DEBUG "%s: VIDIOCCAPTURE - on=%d\n", |
2205 | ZR_DEVNAME(zr), *on); | 2206 | ZR_DEVNAME(zr), *on); |
2206 | 2207 | ||
2207 | down(&zr->resource_lock); | 2208 | mutex_lock(&zr->resource_lock); |
2208 | res = setup_overlay(file, *on); | 2209 | res = setup_overlay(file, *on); |
2209 | up(&zr->resource_lock); | 2210 | mutex_unlock(&zr->resource_lock); |
2210 | 2211 | ||
2211 | return res; | 2212 | return res; |
2212 | } | 2213 | } |
@@ -2219,12 +2220,12 @@ zoran_do_ioctl (struct inode *inode, | |||
2219 | dprintk(3, KERN_DEBUG "%s: VIDIOCGWIN\n", ZR_DEVNAME(zr)); | 2220 | dprintk(3, KERN_DEBUG "%s: VIDIOCGWIN\n", ZR_DEVNAME(zr)); |
2220 | 2221 | ||
2221 | memset(vwin, 0, sizeof(struct video_window)); | 2222 | memset(vwin, 0, sizeof(struct video_window)); |
2222 | down(&zr->resource_lock); | 2223 | mutex_lock(&zr->resource_lock); |
2223 | vwin->x = fh->overlay_settings.x; | 2224 | vwin->x = fh->overlay_settings.x; |
2224 | vwin->y = fh->overlay_settings.y; | 2225 | vwin->y = fh->overlay_settings.y; |
2225 | vwin->width = fh->overlay_settings.width; | 2226 | vwin->width = fh->overlay_settings.width; |
2226 | vwin->height = fh->overlay_settings.height; | 2227 | vwin->height = fh->overlay_settings.height; |
2227 | up(&zr->resource_lock); | 2228 | mutex_unlock(&zr->resource_lock); |
2228 | vwin->clipcount = 0; | 2229 | vwin->clipcount = 0; |
2229 | return 0; | 2230 | return 0; |
2230 | } | 2231 | } |
@@ -2241,12 +2242,12 @@ zoran_do_ioctl (struct inode *inode, | |||
2241 | ZR_DEVNAME(zr), vwin->x, vwin->y, vwin->width, | 2242 | ZR_DEVNAME(zr), vwin->x, vwin->y, vwin->width, |
2242 | vwin->height, vwin->clipcount); | 2243 | vwin->height, vwin->clipcount); |
2243 | 2244 | ||
2244 | down(&zr->resource_lock); | 2245 | mutex_lock(&zr->resource_lock); |
2245 | res = | 2246 | res = |
2246 | setup_window(file, vwin->x, vwin->y, vwin->width, | 2247 | setup_window(file, vwin->x, vwin->y, vwin->width, |
2247 | vwin->height, vwin->clips, | 2248 | vwin->height, vwin->clips, |
2248 | vwin->clipcount, NULL); | 2249 | vwin->clipcount, NULL); |
2249 | up(&zr->resource_lock); | 2250 | mutex_unlock(&zr->resource_lock); |
2250 | 2251 | ||
2251 | return res; | 2252 | return res; |
2252 | } | 2253 | } |
@@ -2258,9 +2259,9 @@ zoran_do_ioctl (struct inode *inode, | |||
2258 | 2259 | ||
2259 | dprintk(3, KERN_DEBUG "%s: VIDIOCGFBUF\n", ZR_DEVNAME(zr)); | 2260 | dprintk(3, KERN_DEBUG "%s: VIDIOCGFBUF\n", ZR_DEVNAME(zr)); |
2260 | 2261 | ||
2261 | down(&zr->resource_lock); | 2262 | mutex_lock(&zr->resource_lock); |
2262 | *vbuf = zr->buffer; | 2263 | *vbuf = zr->buffer; |
2263 | up(&zr->resource_lock); | 2264 | mutex_unlock(&zr->resource_lock); |
2264 | return 0; | 2265 | return 0; |
2265 | } | 2266 | } |
2266 | break; | 2267 | break; |
@@ -2287,12 +2288,12 @@ zoran_do_ioctl (struct inode *inode, | |||
2287 | return -EINVAL; | 2288 | return -EINVAL; |
2288 | } | 2289 | } |
2289 | 2290 | ||
2290 | down(&zr->resource_lock); | 2291 | mutex_lock(&zr->resource_lock); |
2291 | res = | 2292 | res = |
2292 | setup_fbuffer(file, vbuf->base, &zoran_formats[i], | 2293 | setup_fbuffer(file, vbuf->base, &zoran_formats[i], |
2293 | vbuf->width, vbuf->height, | 2294 | vbuf->width, vbuf->height, |
2294 | vbuf->bytesperline); | 2295 | vbuf->bytesperline); |
2295 | up(&zr->resource_lock); | 2296 | mutex_unlock(&zr->resource_lock); |
2296 | 2297 | ||
2297 | return res; | 2298 | return res; |
2298 | } | 2299 | } |
@@ -2305,9 +2306,9 @@ zoran_do_ioctl (struct inode *inode, | |||
2305 | dprintk(3, KERN_DEBUG "%s: VIDIOCSYNC - frame=%d\n", | 2306 | dprintk(3, KERN_DEBUG "%s: VIDIOCSYNC - frame=%d\n", |
2306 | ZR_DEVNAME(zr), *frame); | 2307 | ZR_DEVNAME(zr), *frame); |
2307 | 2308 | ||
2308 | down(&zr->resource_lock); | 2309 | mutex_lock(&zr->resource_lock); |
2309 | res = v4l_sync(file, *frame); | 2310 | res = v4l_sync(file, *frame); |
2310 | up(&zr->resource_lock); | 2311 | mutex_unlock(&zr->resource_lock); |
2311 | if (!res) | 2312 | if (!res) |
2312 | zr->v4l_sync_tail++; | 2313 | zr->v4l_sync_tail++; |
2313 | return res; | 2314 | return res; |
@@ -2325,9 +2326,9 @@ zoran_do_ioctl (struct inode *inode, | |||
2325 | ZR_DEVNAME(zr), vmap->frame, vmap->width, vmap->height, | 2326 | ZR_DEVNAME(zr), vmap->frame, vmap->width, vmap->height, |
2326 | vmap->format); | 2327 | vmap->format); |
2327 | 2328 | ||
2328 | down(&zr->resource_lock); | 2329 | mutex_lock(&zr->resource_lock); |
2329 | res = v4l_grab(file, vmap); | 2330 | res = v4l_grab(file, vmap); |
2330 | up(&zr->resource_lock); | 2331 | mutex_unlock(&zr->resource_lock); |
2331 | return res; | 2332 | return res; |
2332 | } | 2333 | } |
2333 | break; | 2334 | break; |
@@ -2348,7 +2349,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2348 | i * fh->v4l_buffers.buffer_size; | 2349 | i * fh->v4l_buffers.buffer_size; |
2349 | } | 2350 | } |
2350 | 2351 | ||
2351 | down(&zr->resource_lock); | 2352 | mutex_lock(&zr->resource_lock); |
2352 | 2353 | ||
2353 | if (fh->jpg_buffers.allocated || fh->v4l_buffers.allocated) { | 2354 | if (fh->jpg_buffers.allocated || fh->v4l_buffers.allocated) { |
2354 | dprintk(1, | 2355 | dprintk(1, |
@@ -2367,7 +2368,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2367 | /* The next mmap will map the V4L buffers */ | 2368 | /* The next mmap will map the V4L buffers */ |
2368 | fh->map_mode = ZORAN_MAP_MODE_RAW; | 2369 | fh->map_mode = ZORAN_MAP_MODE_RAW; |
2369 | v4l1reqbuf_unlock_and_return: | 2370 | v4l1reqbuf_unlock_and_return: |
2370 | up(&zr->resource_lock); | 2371 | mutex_unlock(&zr->resource_lock); |
2371 | 2372 | ||
2372 | return res; | 2373 | return res; |
2373 | } | 2374 | } |
@@ -2421,7 +2422,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2421 | bparams->major_version = MAJOR_VERSION; | 2422 | bparams->major_version = MAJOR_VERSION; |
2422 | bparams->minor_version = MINOR_VERSION; | 2423 | bparams->minor_version = MINOR_VERSION; |
2423 | 2424 | ||
2424 | down(&zr->resource_lock); | 2425 | mutex_lock(&zr->resource_lock); |
2425 | 2426 | ||
2426 | bparams->norm = zr->norm; | 2427 | bparams->norm = zr->norm; |
2427 | bparams->input = zr->input; | 2428 | bparams->input = zr->input; |
@@ -2450,7 +2451,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2450 | bparams->jpeg_markers = | 2451 | bparams->jpeg_markers = |
2451 | fh->jpg_settings.jpg_comp.jpeg_markers; | 2452 | fh->jpg_settings.jpg_comp.jpeg_markers; |
2452 | 2453 | ||
2453 | up(&zr->resource_lock); | 2454 | mutex_unlock(&zr->resource_lock); |
2454 | 2455 | ||
2455 | bparams->VFIFO_FB = 0; | 2456 | bparams->VFIFO_FB = 0; |
2456 | 2457 | ||
@@ -2486,7 +2487,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2486 | sizeof(bparams->COM_data)); | 2487 | sizeof(bparams->COM_data)); |
2487 | settings.jpg_comp.jpeg_markers = bparams->jpeg_markers; | 2488 | settings.jpg_comp.jpeg_markers = bparams->jpeg_markers; |
2488 | 2489 | ||
2489 | down(&zr->resource_lock); | 2490 | mutex_lock(&zr->resource_lock); |
2490 | 2491 | ||
2491 | if (zr->codec_mode != BUZ_MODE_IDLE) { | 2492 | if (zr->codec_mode != BUZ_MODE_IDLE) { |
2492 | dprintk(1, | 2493 | dprintk(1, |
@@ -2506,7 +2507,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2506 | 2507 | ||
2507 | fh->jpg_settings = settings; | 2508 | fh->jpg_settings = settings; |
2508 | sparams_unlock_and_return: | 2509 | sparams_unlock_and_return: |
2509 | up(&zr->resource_lock); | 2510 | mutex_unlock(&zr->resource_lock); |
2510 | 2511 | ||
2511 | return res; | 2512 | return res; |
2512 | } | 2513 | } |
@@ -2538,7 +2539,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2538 | breq->size > MAX_KMALLOC_MEM) | 2539 | breq->size > MAX_KMALLOC_MEM) |
2539 | breq->size = MAX_KMALLOC_MEM; | 2540 | breq->size = MAX_KMALLOC_MEM; |
2540 | 2541 | ||
2541 | down(&zr->resource_lock); | 2542 | mutex_lock(&zr->resource_lock); |
2542 | 2543 | ||
2543 | if (fh->jpg_buffers.allocated || fh->v4l_buffers.allocated) { | 2544 | if (fh->jpg_buffers.allocated || fh->v4l_buffers.allocated) { |
2544 | dprintk(1, | 2545 | dprintk(1, |
@@ -2561,7 +2562,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2561 | * also be *_PLAY, but it doesn't matter here */ | 2562 | * also be *_PLAY, but it doesn't matter here */ |
2562 | fh->map_mode = ZORAN_MAP_MODE_JPG_REC; | 2563 | fh->map_mode = ZORAN_MAP_MODE_JPG_REC; |
2563 | jpgreqbuf_unlock_and_return: | 2564 | jpgreqbuf_unlock_and_return: |
2564 | up(&zr->resource_lock); | 2565 | mutex_unlock(&zr->resource_lock); |
2565 | 2566 | ||
2566 | return res; | 2567 | return res; |
2567 | } | 2568 | } |
@@ -2574,9 +2575,9 @@ zoran_do_ioctl (struct inode *inode, | |||
2574 | dprintk(3, KERN_DEBUG "%s: BUZIOC_QBUF_CAPT - frame=%d\n", | 2575 | dprintk(3, KERN_DEBUG "%s: BUZIOC_QBUF_CAPT - frame=%d\n", |
2575 | ZR_DEVNAME(zr), *frame); | 2576 | ZR_DEVNAME(zr), *frame); |
2576 | 2577 | ||
2577 | down(&zr->resource_lock); | 2578 | mutex_lock(&zr->resource_lock); |
2578 | res = jpg_qbuf(file, *frame, BUZ_MODE_MOTION_COMPRESS); | 2579 | res = jpg_qbuf(file, *frame, BUZ_MODE_MOTION_COMPRESS); |
2579 | up(&zr->resource_lock); | 2580 | mutex_unlock(&zr->resource_lock); |
2580 | 2581 | ||
2581 | return res; | 2582 | return res; |
2582 | } | 2583 | } |
@@ -2589,9 +2590,9 @@ zoran_do_ioctl (struct inode *inode, | |||
2589 | dprintk(3, KERN_DEBUG "%s: BUZIOC_QBUF_PLAY - frame=%d\n", | 2590 | dprintk(3, KERN_DEBUG "%s: BUZIOC_QBUF_PLAY - frame=%d\n", |
2590 | ZR_DEVNAME(zr), *frame); | 2591 | ZR_DEVNAME(zr), *frame); |
2591 | 2592 | ||
2592 | down(&zr->resource_lock); | 2593 | mutex_lock(&zr->resource_lock); |
2593 | res = jpg_qbuf(file, *frame, BUZ_MODE_MOTION_DECOMPRESS); | 2594 | res = jpg_qbuf(file, *frame, BUZ_MODE_MOTION_DECOMPRESS); |
2594 | up(&zr->resource_lock); | 2595 | mutex_unlock(&zr->resource_lock); |
2595 | 2596 | ||
2596 | return res; | 2597 | return res; |
2597 | } | 2598 | } |
@@ -2604,9 +2605,9 @@ zoran_do_ioctl (struct inode *inode, | |||
2604 | 2605 | ||
2605 | dprintk(3, KERN_DEBUG "%s: BUZIOC_SYNC\n", ZR_DEVNAME(zr)); | 2606 | dprintk(3, KERN_DEBUG "%s: BUZIOC_SYNC\n", ZR_DEVNAME(zr)); |
2606 | 2607 | ||
2607 | down(&zr->resource_lock); | 2608 | mutex_lock(&zr->resource_lock); |
2608 | res = jpg_sync(file, bsync); | 2609 | res = jpg_sync(file, bsync); |
2609 | up(&zr->resource_lock); | 2610 | mutex_unlock(&zr->resource_lock); |
2610 | 2611 | ||
2611 | return res; | 2612 | return res; |
2612 | } | 2613 | } |
@@ -2630,7 +2631,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2630 | input = zr->card.input[bstat->input].muxsel; | 2631 | input = zr->card.input[bstat->input].muxsel; |
2631 | norm = VIDEO_MODE_AUTO; | 2632 | norm = VIDEO_MODE_AUTO; |
2632 | 2633 | ||
2633 | down(&zr->resource_lock); | 2634 | mutex_lock(&zr->resource_lock); |
2634 | 2635 | ||
2635 | if (zr->codec_mode != BUZ_MODE_IDLE) { | 2636 | if (zr->codec_mode != BUZ_MODE_IDLE) { |
2636 | dprintk(1, | 2637 | dprintk(1, |
@@ -2655,7 +2656,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2655 | decoder_command(zr, DECODER_SET_INPUT, &input); | 2656 | decoder_command(zr, DECODER_SET_INPUT, &input); |
2656 | decoder_command(zr, DECODER_SET_NORM, &zr->norm); | 2657 | decoder_command(zr, DECODER_SET_NORM, &zr->norm); |
2657 | gstat_unlock_and_return: | 2658 | gstat_unlock_and_return: |
2658 | up(&zr->resource_lock); | 2659 | mutex_unlock(&zr->resource_lock); |
2659 | 2660 | ||
2660 | if (!res) { | 2661 | if (!res) { |
2661 | bstat->signal = | 2662 | bstat->signal = |
@@ -2763,7 +2764,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2763 | switch (fmt->type) { | 2764 | switch (fmt->type) { |
2764 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: | 2765 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: |
2765 | 2766 | ||
2766 | down(&zr->resource_lock); | 2767 | mutex_lock(&zr->resource_lock); |
2767 | 2768 | ||
2768 | fmt->fmt.win.w.left = fh->overlay_settings.x; | 2769 | fmt->fmt.win.w.left = fh->overlay_settings.x; |
2769 | fmt->fmt.win.w.top = fh->overlay_settings.y; | 2770 | fmt->fmt.win.w.top = fh->overlay_settings.y; |
@@ -2776,14 +2777,14 @@ zoran_do_ioctl (struct inode *inode, | |||
2776 | else | 2777 | else |
2777 | fmt->fmt.win.field = V4L2_FIELD_TOP; | 2778 | fmt->fmt.win.field = V4L2_FIELD_TOP; |
2778 | 2779 | ||
2779 | up(&zr->resource_lock); | 2780 | mutex_unlock(&zr->resource_lock); |
2780 | 2781 | ||
2781 | break; | 2782 | break; |
2782 | 2783 | ||
2783 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | 2784 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: |
2784 | case V4L2_BUF_TYPE_VIDEO_OUTPUT: | 2785 | case V4L2_BUF_TYPE_VIDEO_OUTPUT: |
2785 | 2786 | ||
2786 | down(&zr->resource_lock); | 2787 | mutex_lock(&zr->resource_lock); |
2787 | 2788 | ||
2788 | if (fmt->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && | 2789 | if (fmt->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && |
2789 | fh->map_mode == ZORAN_MAP_MODE_RAW) { | 2790 | fh->map_mode == ZORAN_MAP_MODE_RAW) { |
@@ -2837,7 +2838,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2837 | V4L2_COLORSPACE_SMPTE170M; | 2838 | V4L2_COLORSPACE_SMPTE170M; |
2838 | } | 2839 | } |
2839 | 2840 | ||
2840 | up(&zr->resource_lock); | 2841 | mutex_unlock(&zr->resource_lock); |
2841 | 2842 | ||
2842 | break; | 2843 | break; |
2843 | 2844 | ||
@@ -2870,7 +2871,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2870 | fmt->fmt.win.w.height, | 2871 | fmt->fmt.win.w.height, |
2871 | fmt->fmt.win.clipcount, | 2872 | fmt->fmt.win.clipcount, |
2872 | fmt->fmt.win.bitmap); | 2873 | fmt->fmt.win.bitmap); |
2873 | down(&zr->resource_lock); | 2874 | mutex_lock(&zr->resource_lock); |
2874 | res = | 2875 | res = |
2875 | setup_window(file, fmt->fmt.win.w.left, | 2876 | setup_window(file, fmt->fmt.win.w.left, |
2876 | fmt->fmt.win.w.top, | 2877 | fmt->fmt.win.w.top, |
@@ -2880,7 +2881,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2880 | fmt->fmt.win.clips, | 2881 | fmt->fmt.win.clips, |
2881 | fmt->fmt.win.clipcount, | 2882 | fmt->fmt.win.clipcount, |
2882 | fmt->fmt.win.bitmap); | 2883 | fmt->fmt.win.bitmap); |
2883 | up(&zr->resource_lock); | 2884 | mutex_unlock(&zr->resource_lock); |
2884 | return res; | 2885 | return res; |
2885 | break; | 2886 | break; |
2886 | 2887 | ||
@@ -2917,7 +2918,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2917 | } | 2918 | } |
2918 | 2919 | ||
2919 | if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG) { | 2920 | if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG) { |
2920 | down(&zr->resource_lock); | 2921 | mutex_lock(&zr->resource_lock); |
2921 | 2922 | ||
2922 | settings = fh->jpg_settings; | 2923 | settings = fh->jpg_settings; |
2923 | 2924 | ||
@@ -2995,7 +2996,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2995 | ZORAN_MAP_MODE_JPG_REC : | 2996 | ZORAN_MAP_MODE_JPG_REC : |
2996 | ZORAN_MAP_MODE_JPG_PLAY; | 2997 | ZORAN_MAP_MODE_JPG_PLAY; |
2997 | sfmtjpg_unlock_and_return: | 2998 | sfmtjpg_unlock_and_return: |
2998 | up(&zr->resource_lock); | 2999 | mutex_unlock(&zr->resource_lock); |
2999 | } else { | 3000 | } else { |
3000 | for (i = 0; i < zoran_num_formats; i++) | 3001 | for (i = 0; i < zoran_num_formats; i++) |
3001 | if (fmt->fmt.pix.pixelformat == | 3002 | if (fmt->fmt.pix.pixelformat == |
@@ -3010,7 +3011,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3010 | (char *) &printformat); | 3011 | (char *) &printformat); |
3011 | return -EINVAL; | 3012 | return -EINVAL; |
3012 | } | 3013 | } |
3013 | down(&zr->resource_lock); | 3014 | mutex_lock(&zr->resource_lock); |
3014 | if (fh->jpg_buffers.allocated || | 3015 | if (fh->jpg_buffers.allocated || |
3015 | (fh->v4l_buffers.allocated && | 3016 | (fh->v4l_buffers.allocated && |
3016 | fh->v4l_buffers.active != | 3017 | fh->v4l_buffers.active != |
@@ -3052,7 +3053,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3052 | 3053 | ||
3053 | fh->map_mode = ZORAN_MAP_MODE_RAW; | 3054 | fh->map_mode = ZORAN_MAP_MODE_RAW; |
3054 | sfmtv4l_unlock_and_return: | 3055 | sfmtv4l_unlock_and_return: |
3055 | up(&zr->resource_lock); | 3056 | mutex_unlock(&zr->resource_lock); |
3056 | } | 3057 | } |
3057 | 3058 | ||
3058 | break; | 3059 | break; |
@@ -3077,7 +3078,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3077 | dprintk(3, KERN_DEBUG "%s: VIDIOC_G_FBUF\n", ZR_DEVNAME(zr)); | 3078 | dprintk(3, KERN_DEBUG "%s: VIDIOC_G_FBUF\n", ZR_DEVNAME(zr)); |
3078 | 3079 | ||
3079 | memset(fb, 0, sizeof(*fb)); | 3080 | memset(fb, 0, sizeof(*fb)); |
3080 | down(&zr->resource_lock); | 3081 | mutex_lock(&zr->resource_lock); |
3081 | fb->base = zr->buffer.base; | 3082 | fb->base = zr->buffer.base; |
3082 | fb->fmt.width = zr->buffer.width; | 3083 | fb->fmt.width = zr->buffer.width; |
3083 | fb->fmt.height = zr->buffer.height; | 3084 | fb->fmt.height = zr->buffer.height; |
@@ -3086,7 +3087,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3086 | fh->overlay_settings.format->fourcc; | 3087 | fh->overlay_settings.format->fourcc; |
3087 | } | 3088 | } |
3088 | fb->fmt.bytesperline = zr->buffer.bytesperline; | 3089 | fb->fmt.bytesperline = zr->buffer.bytesperline; |
3089 | up(&zr->resource_lock); | 3090 | mutex_unlock(&zr->resource_lock); |
3090 | fb->fmt.colorspace = V4L2_COLORSPACE_SRGB; | 3091 | fb->fmt.colorspace = V4L2_COLORSPACE_SRGB; |
3091 | fb->fmt.field = V4L2_FIELD_INTERLACED; | 3092 | fb->fmt.field = V4L2_FIELD_INTERLACED; |
3092 | fb->flags = V4L2_FBUF_FLAG_OVERLAY; | 3093 | fb->flags = V4L2_FBUF_FLAG_OVERLAY; |
@@ -3121,12 +3122,12 @@ zoran_do_ioctl (struct inode *inode, | |||
3121 | return -EINVAL; | 3122 | return -EINVAL; |
3122 | } | 3123 | } |
3123 | 3124 | ||
3124 | down(&zr->resource_lock); | 3125 | mutex_lock(&zr->resource_lock); |
3125 | res = | 3126 | res = |
3126 | setup_fbuffer(file, fb->base, &zoran_formats[i], | 3127 | setup_fbuffer(file, fb->base, &zoran_formats[i], |
3127 | fb->fmt.width, fb->fmt.height, | 3128 | fb->fmt.width, fb->fmt.height, |
3128 | fb->fmt.bytesperline); | 3129 | fb->fmt.bytesperline); |
3129 | up(&zr->resource_lock); | 3130 | mutex_unlock(&zr->resource_lock); |
3130 | 3131 | ||
3131 | return res; | 3132 | return res; |
3132 | } | 3133 | } |
@@ -3139,9 +3140,9 @@ zoran_do_ioctl (struct inode *inode, | |||
3139 | dprintk(3, KERN_DEBUG "%s: VIDIOC_PREVIEW - on=%d\n", | 3140 | dprintk(3, KERN_DEBUG "%s: VIDIOC_PREVIEW - on=%d\n", |
3140 | ZR_DEVNAME(zr), *on); | 3141 | ZR_DEVNAME(zr), *on); |
3141 | 3142 | ||
3142 | down(&zr->resource_lock); | 3143 | mutex_lock(&zr->resource_lock); |
3143 | res = setup_overlay(file, *on); | 3144 | res = setup_overlay(file, *on); |
3144 | up(&zr->resource_lock); | 3145 | mutex_unlock(&zr->resource_lock); |
3145 | 3146 | ||
3146 | return res; | 3147 | return res; |
3147 | } | 3148 | } |
@@ -3163,7 +3164,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3163 | return -EINVAL; | 3164 | return -EINVAL; |
3164 | } | 3165 | } |
3165 | 3166 | ||
3166 | down(&zr->resource_lock); | 3167 | mutex_lock(&zr->resource_lock); |
3167 | 3168 | ||
3168 | if (fh->v4l_buffers.allocated || fh->jpg_buffers.allocated) { | 3169 | if (fh->v4l_buffers.allocated || fh->jpg_buffers.allocated) { |
3169 | dprintk(1, | 3170 | dprintk(1, |
@@ -3224,7 +3225,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3224 | goto v4l2reqbuf_unlock_and_return; | 3225 | goto v4l2reqbuf_unlock_and_return; |
3225 | } | 3226 | } |
3226 | v4l2reqbuf_unlock_and_return: | 3227 | v4l2reqbuf_unlock_and_return: |
3227 | up(&zr->resource_lock); | 3228 | mutex_unlock(&zr->resource_lock); |
3228 | 3229 | ||
3229 | return 0; | 3230 | return 0; |
3230 | } | 3231 | } |
@@ -3245,9 +3246,9 @@ zoran_do_ioctl (struct inode *inode, | |||
3245 | buf->type = type; | 3246 | buf->type = type; |
3246 | buf->index = index; | 3247 | buf->index = index; |
3247 | 3248 | ||
3248 | down(&zr->resource_lock); | 3249 | mutex_lock(&zr->resource_lock); |
3249 | res = zoran_v4l2_buffer_status(file, buf, buf->index); | 3250 | res = zoran_v4l2_buffer_status(file, buf, buf->index); |
3250 | up(&zr->resource_lock); | 3251 | mutex_unlock(&zr->resource_lock); |
3251 | 3252 | ||
3252 | return res; | 3253 | return res; |
3253 | } | 3254 | } |
@@ -3262,7 +3263,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3262 | KERN_DEBUG "%s: VIDIOC_QBUF - type=%d, index=%d\n", | 3263 | KERN_DEBUG "%s: VIDIOC_QBUF - type=%d, index=%d\n", |
3263 | ZR_DEVNAME(zr), buf->type, buf->index); | 3264 | ZR_DEVNAME(zr), buf->type, buf->index); |
3264 | 3265 | ||
3265 | down(&zr->resource_lock); | 3266 | mutex_lock(&zr->resource_lock); |
3266 | 3267 | ||
3267 | switch (fh->map_mode) { | 3268 | switch (fh->map_mode) { |
3268 | case ZORAN_MAP_MODE_RAW: | 3269 | case ZORAN_MAP_MODE_RAW: |
@@ -3322,7 +3323,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3322 | goto qbuf_unlock_and_return; | 3323 | goto qbuf_unlock_and_return; |
3323 | } | 3324 | } |
3324 | qbuf_unlock_and_return: | 3325 | qbuf_unlock_and_return: |
3325 | up(&zr->resource_lock); | 3326 | mutex_unlock(&zr->resource_lock); |
3326 | 3327 | ||
3327 | return res; | 3328 | return res; |
3328 | } | 3329 | } |
@@ -3336,7 +3337,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3336 | dprintk(3, KERN_DEBUG "%s: VIDIOC_DQBUF - type=%d\n", | 3337 | dprintk(3, KERN_DEBUG "%s: VIDIOC_DQBUF - type=%d\n", |
3337 | ZR_DEVNAME(zr), buf->type); | 3338 | ZR_DEVNAME(zr), buf->type); |
3338 | 3339 | ||
3339 | down(&zr->resource_lock); | 3340 | mutex_lock(&zr->resource_lock); |
3340 | 3341 | ||
3341 | switch (fh->map_mode) { | 3342 | switch (fh->map_mode) { |
3342 | case ZORAN_MAP_MODE_RAW: | 3343 | case ZORAN_MAP_MODE_RAW: |
@@ -3410,7 +3411,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3410 | goto dqbuf_unlock_and_return; | 3411 | goto dqbuf_unlock_and_return; |
3411 | } | 3412 | } |
3412 | dqbuf_unlock_and_return: | 3413 | dqbuf_unlock_and_return: |
3413 | up(&zr->resource_lock); | 3414 | mutex_unlock(&zr->resource_lock); |
3414 | 3415 | ||
3415 | return res; | 3416 | return res; |
3416 | } | 3417 | } |
@@ -3422,7 +3423,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3422 | 3423 | ||
3423 | dprintk(3, KERN_DEBUG "%s: VIDIOC_STREAMON\n", ZR_DEVNAME(zr)); | 3424 | dprintk(3, KERN_DEBUG "%s: VIDIOC_STREAMON\n", ZR_DEVNAME(zr)); |
3424 | 3425 | ||
3425 | down(&zr->resource_lock); | 3426 | mutex_lock(&zr->resource_lock); |
3426 | 3427 | ||
3427 | switch (fh->map_mode) { | 3428 | switch (fh->map_mode) { |
3428 | case ZORAN_MAP_MODE_RAW: /* raw capture */ | 3429 | case ZORAN_MAP_MODE_RAW: /* raw capture */ |
@@ -3470,7 +3471,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3470 | goto strmon_unlock_and_return; | 3471 | goto strmon_unlock_and_return; |
3471 | } | 3472 | } |
3472 | strmon_unlock_and_return: | 3473 | strmon_unlock_and_return: |
3473 | up(&zr->resource_lock); | 3474 | mutex_unlock(&zr->resource_lock); |
3474 | 3475 | ||
3475 | return res; | 3476 | return res; |
3476 | } | 3477 | } |
@@ -3482,7 +3483,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3482 | 3483 | ||
3483 | dprintk(3, KERN_DEBUG "%s: VIDIOC_STREAMOFF\n", ZR_DEVNAME(zr)); | 3484 | dprintk(3, KERN_DEBUG "%s: VIDIOC_STREAMOFF\n", ZR_DEVNAME(zr)); |
3484 | 3485 | ||
3485 | down(&zr->resource_lock); | 3486 | mutex_lock(&zr->resource_lock); |
3486 | 3487 | ||
3487 | switch (fh->map_mode) { | 3488 | switch (fh->map_mode) { |
3488 | case ZORAN_MAP_MODE_RAW: /* raw capture */ | 3489 | case ZORAN_MAP_MODE_RAW: /* raw capture */ |
@@ -3540,7 +3541,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3540 | goto strmoff_unlock_and_return; | 3541 | goto strmoff_unlock_and_return; |
3541 | } | 3542 | } |
3542 | strmoff_unlock_and_return: | 3543 | strmoff_unlock_and_return: |
3543 | up(&zr->resource_lock); | 3544 | mutex_unlock(&zr->resource_lock); |
3544 | 3545 | ||
3545 | return res; | 3546 | return res; |
3546 | } | 3547 | } |
@@ -3600,7 +3601,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3600 | ctrl->id > V4L2_CID_HUE) | 3601 | ctrl->id > V4L2_CID_HUE) |
3601 | return -EINVAL; | 3602 | return -EINVAL; |
3602 | 3603 | ||
3603 | down(&zr->resource_lock); | 3604 | mutex_lock(&zr->resource_lock); |
3604 | switch (ctrl->id) { | 3605 | switch (ctrl->id) { |
3605 | case V4L2_CID_BRIGHTNESS: | 3606 | case V4L2_CID_BRIGHTNESS: |
3606 | ctrl->value = zr->brightness; | 3607 | ctrl->value = zr->brightness; |
@@ -3615,7 +3616,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3615 | ctrl->value = zr->hue; | 3616 | ctrl->value = zr->hue; |
3616 | break; | 3617 | break; |
3617 | } | 3618 | } |
3618 | up(&zr->resource_lock); | 3619 | mutex_unlock(&zr->resource_lock); |
3619 | 3620 | ||
3620 | return 0; | 3621 | return 0; |
3621 | } | 3622 | } |
@@ -3642,7 +3643,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3642 | return -EINVAL; | 3643 | return -EINVAL; |
3643 | } | 3644 | } |
3644 | 3645 | ||
3645 | down(&zr->resource_lock); | 3646 | mutex_lock(&zr->resource_lock); |
3646 | switch (ctrl->id) { | 3647 | switch (ctrl->id) { |
3647 | case V4L2_CID_BRIGHTNESS: | 3648 | case V4L2_CID_BRIGHTNESS: |
3648 | zr->brightness = ctrl->value; | 3649 | zr->brightness = ctrl->value; |
@@ -3664,7 +3665,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3664 | 3665 | ||
3665 | decoder_command(zr, DECODER_SET_PICTURE, &pict); | 3666 | decoder_command(zr, DECODER_SET_PICTURE, &pict); |
3666 | 3667 | ||
3667 | up(&zr->resource_lock); | 3668 | mutex_unlock(&zr->resource_lock); |
3668 | 3669 | ||
3669 | return 0; | 3670 | return 0; |
3670 | } | 3671 | } |
@@ -3732,9 +3733,9 @@ zoran_do_ioctl (struct inode *inode, | |||
3732 | 3733 | ||
3733 | dprintk(3, KERN_DEBUG "%s: VIDIOC_G_STD\n", ZR_DEVNAME(zr)); | 3734 | dprintk(3, KERN_DEBUG "%s: VIDIOC_G_STD\n", ZR_DEVNAME(zr)); |
3734 | 3735 | ||
3735 | down(&zr->resource_lock); | 3736 | mutex_lock(&zr->resource_lock); |
3736 | norm = zr->norm; | 3737 | norm = zr->norm; |
3737 | up(&zr->resource_lock); | 3738 | mutex_unlock(&zr->resource_lock); |
3738 | 3739 | ||
3739 | switch (norm) { | 3740 | switch (norm) { |
3740 | case VIDEO_MODE_PAL: | 3741 | case VIDEO_MODE_PAL: |
@@ -3776,13 +3777,13 @@ zoran_do_ioctl (struct inode *inode, | |||
3776 | return -EINVAL; | 3777 | return -EINVAL; |
3777 | } | 3778 | } |
3778 | 3779 | ||
3779 | down(&zr->resource_lock); | 3780 | mutex_lock(&zr->resource_lock); |
3780 | if ((res = zoran_set_norm(zr, norm))) | 3781 | if ((res = zoran_set_norm(zr, norm))) |
3781 | goto sstd_unlock_and_return; | 3782 | goto sstd_unlock_and_return; |
3782 | 3783 | ||
3783 | res = wait_grab_pending(zr); | 3784 | res = wait_grab_pending(zr); |
3784 | sstd_unlock_and_return: | 3785 | sstd_unlock_and_return: |
3785 | up(&zr->resource_lock); | 3786 | mutex_unlock(&zr->resource_lock); |
3786 | return res; | 3787 | return res; |
3787 | } | 3788 | } |
3788 | break; | 3789 | break; |
@@ -3809,9 +3810,9 @@ zoran_do_ioctl (struct inode *inode, | |||
3809 | inp->std = V4L2_STD_ALL; | 3810 | inp->std = V4L2_STD_ALL; |
3810 | 3811 | ||
3811 | /* Get status of video decoder */ | 3812 | /* Get status of video decoder */ |
3812 | down(&zr->resource_lock); | 3813 | mutex_lock(&zr->resource_lock); |
3813 | decoder_command(zr, DECODER_GET_STATUS, &status); | 3814 | decoder_command(zr, DECODER_GET_STATUS, &status); |
3814 | up(&zr->resource_lock); | 3815 | mutex_unlock(&zr->resource_lock); |
3815 | 3816 | ||
3816 | if (!(status & DECODER_STATUS_GOOD)) { | 3817 | if (!(status & DECODER_STATUS_GOOD)) { |
3817 | inp->status |= V4L2_IN_ST_NO_POWER; | 3818 | inp->status |= V4L2_IN_ST_NO_POWER; |
@@ -3830,9 +3831,9 @@ zoran_do_ioctl (struct inode *inode, | |||
3830 | 3831 | ||
3831 | dprintk(3, KERN_DEBUG "%s: VIDIOC_G_INPUT\n", ZR_DEVNAME(zr)); | 3832 | dprintk(3, KERN_DEBUG "%s: VIDIOC_G_INPUT\n", ZR_DEVNAME(zr)); |
3832 | 3833 | ||
3833 | down(&zr->resource_lock); | 3834 | mutex_lock(&zr->resource_lock); |
3834 | *input = zr->input; | 3835 | *input = zr->input; |
3835 | up(&zr->resource_lock); | 3836 | mutex_unlock(&zr->resource_lock); |
3836 | 3837 | ||
3837 | return 0; | 3838 | return 0; |
3838 | } | 3839 | } |
@@ -3845,14 +3846,14 @@ zoran_do_ioctl (struct inode *inode, | |||
3845 | dprintk(3, KERN_DEBUG "%s: VIDIOC_S_INPUT - input=%d\n", | 3846 | dprintk(3, KERN_DEBUG "%s: VIDIOC_S_INPUT - input=%d\n", |
3846 | ZR_DEVNAME(zr), *input); | 3847 | ZR_DEVNAME(zr), *input); |
3847 | 3848 | ||
3848 | down(&zr->resource_lock); | 3849 | mutex_lock(&zr->resource_lock); |
3849 | if ((res = zoran_set_input(zr, *input))) | 3850 | if ((res = zoran_set_input(zr, *input))) |
3850 | goto sinput_unlock_and_return; | 3851 | goto sinput_unlock_and_return; |
3851 | 3852 | ||
3852 | /* Make sure the changes come into effect */ | 3853 | /* Make sure the changes come into effect */ |
3853 | res = wait_grab_pending(zr); | 3854 | res = wait_grab_pending(zr); |
3854 | sinput_unlock_and_return: | 3855 | sinput_unlock_and_return: |
3855 | up(&zr->resource_lock); | 3856 | mutex_unlock(&zr->resource_lock); |
3856 | return res; | 3857 | return res; |
3857 | } | 3858 | } |
3858 | break; | 3859 | break; |
@@ -3914,7 +3915,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3914 | memset(cropcap, 0, sizeof(*cropcap)); | 3915 | memset(cropcap, 0, sizeof(*cropcap)); |
3915 | cropcap->type = type; | 3916 | cropcap->type = type; |
3916 | 3917 | ||
3917 | down(&zr->resource_lock); | 3918 | mutex_lock(&zr->resource_lock); |
3918 | 3919 | ||
3919 | if (cropcap->type != V4L2_BUF_TYPE_VIDEO_OUTPUT && | 3920 | if (cropcap->type != V4L2_BUF_TYPE_VIDEO_OUTPUT && |
3920 | (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || | 3921 | (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || |
@@ -3934,7 +3935,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3934 | cropcap->defrect.width = BUZ_MIN_WIDTH; | 3935 | cropcap->defrect.width = BUZ_MIN_WIDTH; |
3935 | cropcap->defrect.height = BUZ_MIN_HEIGHT; | 3936 | cropcap->defrect.height = BUZ_MIN_HEIGHT; |
3936 | cropcap_unlock_and_return: | 3937 | cropcap_unlock_and_return: |
3937 | up(&zr->resource_lock); | 3938 | mutex_unlock(&zr->resource_lock); |
3938 | return res; | 3939 | return res; |
3939 | } | 3940 | } |
3940 | break; | 3941 | break; |
@@ -3950,7 +3951,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3950 | memset(crop, 0, sizeof(*crop)); | 3951 | memset(crop, 0, sizeof(*crop)); |
3951 | crop->type = type; | 3952 | crop->type = type; |
3952 | 3953 | ||
3953 | down(&zr->resource_lock); | 3954 | mutex_lock(&zr->resource_lock); |
3954 | 3955 | ||
3955 | if (crop->type != V4L2_BUF_TYPE_VIDEO_OUTPUT && | 3956 | if (crop->type != V4L2_BUF_TYPE_VIDEO_OUTPUT && |
3956 | (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || | 3957 | (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || |
@@ -3969,7 +3970,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3969 | crop->c.height = fh->jpg_settings.img_height; | 3970 | crop->c.height = fh->jpg_settings.img_height; |
3970 | 3971 | ||
3971 | gcrop_unlock_and_return: | 3972 | gcrop_unlock_and_return: |
3972 | up(&zr->resource_lock); | 3973 | mutex_unlock(&zr->resource_lock); |
3973 | 3974 | ||
3974 | return res; | 3975 | return res; |
3975 | } | 3976 | } |
@@ -3988,7 +3989,7 @@ zoran_do_ioctl (struct inode *inode, | |||
3988 | ZR_DEVNAME(zr), crop->type, crop->c.left, crop->c.top, | 3989 | ZR_DEVNAME(zr), crop->type, crop->c.left, crop->c.top, |
3989 | crop->c.width, crop->c.height); | 3990 | crop->c.width, crop->c.height); |
3990 | 3991 | ||
3991 | down(&zr->resource_lock); | 3992 | mutex_lock(&zr->resource_lock); |
3992 | 3993 | ||
3993 | if (fh->jpg_buffers.allocated || fh->v4l_buffers.allocated) { | 3994 | if (fh->jpg_buffers.allocated || fh->v4l_buffers.allocated) { |
3994 | dprintk(1, | 3995 | dprintk(1, |
@@ -4024,7 +4025,7 @@ zoran_do_ioctl (struct inode *inode, | |||
4024 | fh->jpg_settings = settings; | 4025 | fh->jpg_settings = settings; |
4025 | 4026 | ||
4026 | scrop_unlock_and_return: | 4027 | scrop_unlock_and_return: |
4027 | up(&zr->resource_lock); | 4028 | mutex_unlock(&zr->resource_lock); |
4028 | return res; | 4029 | return res; |
4029 | } | 4030 | } |
4030 | break; | 4031 | break; |
@@ -4038,7 +4039,7 @@ zoran_do_ioctl (struct inode *inode, | |||
4038 | 4039 | ||
4039 | memset(params, 0, sizeof(*params)); | 4040 | memset(params, 0, sizeof(*params)); |
4040 | 4041 | ||
4041 | down(&zr->resource_lock); | 4042 | mutex_lock(&zr->resource_lock); |
4042 | 4043 | ||
4043 | params->quality = fh->jpg_settings.jpg_comp.quality; | 4044 | params->quality = fh->jpg_settings.jpg_comp.quality; |
4044 | params->APPn = fh->jpg_settings.jpg_comp.APPn; | 4045 | params->APPn = fh->jpg_settings.jpg_comp.APPn; |
@@ -4053,7 +4054,7 @@ zoran_do_ioctl (struct inode *inode, | |||
4053 | params->jpeg_markers = | 4054 | params->jpeg_markers = |
4054 | fh->jpg_settings.jpg_comp.jpeg_markers; | 4055 | fh->jpg_settings.jpg_comp.jpeg_markers; |
4055 | 4056 | ||
4056 | up(&zr->resource_lock); | 4057 | mutex_unlock(&zr->resource_lock); |
4057 | 4058 | ||
4058 | return 0; | 4059 | return 0; |
4059 | } | 4060 | } |
@@ -4074,7 +4075,7 @@ zoran_do_ioctl (struct inode *inode, | |||
4074 | 4075 | ||
4075 | settings.jpg_comp = *params; | 4076 | settings.jpg_comp = *params; |
4076 | 4077 | ||
4077 | down(&zr->resource_lock); | 4078 | mutex_lock(&zr->resource_lock); |
4078 | 4079 | ||
4079 | if (fh->v4l_buffers.active != ZORAN_FREE || | 4080 | if (fh->v4l_buffers.active != ZORAN_FREE || |
4080 | fh->jpg_buffers.active != ZORAN_FREE) { | 4081 | fh->jpg_buffers.active != ZORAN_FREE) { |
@@ -4093,7 +4094,7 @@ zoran_do_ioctl (struct inode *inode, | |||
4093 | zoran_v4l2_calc_bufsize(&fh->jpg_settings); | 4094 | zoran_v4l2_calc_bufsize(&fh->jpg_settings); |
4094 | fh->jpg_settings.jpg_comp = *params = settings.jpg_comp; | 4095 | fh->jpg_settings.jpg_comp = *params = settings.jpg_comp; |
4095 | sjpegc_unlock_and_return: | 4096 | sjpegc_unlock_and_return: |
4096 | up(&zr->resource_lock); | 4097 | mutex_unlock(&zr->resource_lock); |
4097 | 4098 | ||
4098 | return 0; | 4099 | return 0; |
4099 | } | 4100 | } |
@@ -4127,7 +4128,7 @@ zoran_do_ioctl (struct inode *inode, | |||
4127 | 4128 | ||
4128 | switch (fmt->type) { | 4129 | switch (fmt->type) { |
4129 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: | 4130 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: |
4130 | down(&zr->resource_lock); | 4131 | mutex_lock(&zr->resource_lock); |
4131 | 4132 | ||
4132 | if (fmt->fmt.win.w.width > BUZ_MAX_WIDTH) | 4133 | if (fmt->fmt.win.w.width > BUZ_MAX_WIDTH) |
4133 | fmt->fmt.win.w.width = BUZ_MAX_WIDTH; | 4134 | fmt->fmt.win.w.width = BUZ_MAX_WIDTH; |
@@ -4138,7 +4139,7 @@ zoran_do_ioctl (struct inode *inode, | |||
4138 | if (fmt->fmt.win.w.height < BUZ_MIN_HEIGHT) | 4139 | if (fmt->fmt.win.w.height < BUZ_MIN_HEIGHT) |
4139 | fmt->fmt.win.w.height = BUZ_MIN_HEIGHT; | 4140 | fmt->fmt.win.w.height = BUZ_MIN_HEIGHT; |
4140 | 4141 | ||
4141 | up(&zr->resource_lock); | 4142 | mutex_unlock(&zr->resource_lock); |
4142 | break; | 4143 | break; |
4143 | 4144 | ||
4144 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | 4145 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: |
@@ -4146,7 +4147,7 @@ zoran_do_ioctl (struct inode *inode, | |||
4146 | if (fmt->fmt.pix.bytesperline > 0) | 4147 | if (fmt->fmt.pix.bytesperline > 0) |
4147 | return -EINVAL; | 4148 | return -EINVAL; |
4148 | 4149 | ||
4149 | down(&zr->resource_lock); | 4150 | mutex_lock(&zr->resource_lock); |
4150 | 4151 | ||
4151 | if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG) { | 4152 | if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG) { |
4152 | settings = fh->jpg_settings; | 4153 | settings = fh->jpg_settings; |
@@ -4229,7 +4230,7 @@ zoran_do_ioctl (struct inode *inode, | |||
4229 | goto tryfmt_unlock_and_return; | 4230 | goto tryfmt_unlock_and_return; |
4230 | } | 4231 | } |
4231 | tryfmt_unlock_and_return: | 4232 | tryfmt_unlock_and_return: |
4232 | up(&zr->resource_lock); | 4233 | mutex_unlock(&zr->resource_lock); |
4233 | 4234 | ||
4234 | return res; | 4235 | return res; |
4235 | break; | 4236 | break; |
@@ -4280,7 +4281,7 @@ zoran_poll (struct file *file, | |||
4280 | * if no buffers queued or so, return POLLNVAL | 4281 | * if no buffers queued or so, return POLLNVAL |
4281 | */ | 4282 | */ |
4282 | 4283 | ||
4283 | down(&zr->resource_lock); | 4284 | mutex_lock(&zr->resource_lock); |
4284 | 4285 | ||
4285 | switch (fh->map_mode) { | 4286 | switch (fh->map_mode) { |
4286 | case ZORAN_MAP_MODE_RAW: | 4287 | case ZORAN_MAP_MODE_RAW: |
@@ -4329,7 +4330,7 @@ zoran_poll (struct file *file, | |||
4329 | } | 4330 | } |
4330 | 4331 | ||
4331 | poll_unlock_and_return: | 4332 | poll_unlock_and_return: |
4332 | up(&zr->resource_lock); | 4333 | mutex_unlock(&zr->resource_lock); |
4333 | 4334 | ||
4334 | return res; | 4335 | return res; |
4335 | } | 4336 | } |
@@ -4385,7 +4386,7 @@ zoran_vm_close (struct vm_area_struct *vma) | |||
4385 | if (fh->jpg_buffers.buffer[i].map) | 4386 | if (fh->jpg_buffers.buffer[i].map) |
4386 | break; | 4387 | break; |
4387 | if (i == fh->jpg_buffers.num_buffers) { | 4388 | if (i == fh->jpg_buffers.num_buffers) { |
4388 | down(&zr->resource_lock); | 4389 | mutex_lock(&zr->resource_lock); |
4389 | 4390 | ||
4390 | if (fh->jpg_buffers.active != ZORAN_FREE) { | 4391 | if (fh->jpg_buffers.active != ZORAN_FREE) { |
4391 | jpg_qbuf(file, -1, zr->codec_mode); | 4392 | jpg_qbuf(file, -1, zr->codec_mode); |
@@ -4398,7 +4399,7 @@ zoran_vm_close (struct vm_area_struct *vma) | |||
4398 | fh->jpg_buffers.allocated = 0; | 4399 | fh->jpg_buffers.allocated = 0; |
4399 | fh->jpg_buffers.ready_to_be_freed = 1; | 4400 | fh->jpg_buffers.ready_to_be_freed = 1; |
4400 | 4401 | ||
4401 | up(&zr->resource_lock); | 4402 | mutex_unlock(&zr->resource_lock); |
4402 | } | 4403 | } |
4403 | 4404 | ||
4404 | break; | 4405 | break; |
@@ -4421,7 +4422,7 @@ zoran_vm_close (struct vm_area_struct *vma) | |||
4421 | if (fh->v4l_buffers.buffer[i].map) | 4422 | if (fh->v4l_buffers.buffer[i].map) |
4422 | break; | 4423 | break; |
4423 | if (i == fh->v4l_buffers.num_buffers) { | 4424 | if (i == fh->v4l_buffers.num_buffers) { |
4424 | down(&zr->resource_lock); | 4425 | mutex_lock(&zr->resource_lock); |
4425 | 4426 | ||
4426 | if (fh->v4l_buffers.active != ZORAN_FREE) { | 4427 | if (fh->v4l_buffers.active != ZORAN_FREE) { |
4427 | zr36057_set_memgrab(zr, 0); | 4428 | zr36057_set_memgrab(zr, 0); |
@@ -4434,7 +4435,7 @@ zoran_vm_close (struct vm_area_struct *vma) | |||
4434 | fh->v4l_buffers.allocated = 0; | 4435 | fh->v4l_buffers.allocated = 0; |
4435 | fh->v4l_buffers.ready_to_be_freed = 1; | 4436 | fh->v4l_buffers.ready_to_be_freed = 1; |
4436 | 4437 | ||
4437 | up(&zr->resource_lock); | 4438 | mutex_unlock(&zr->resource_lock); |
4438 | } | 4439 | } |
4439 | 4440 | ||
4440 | break; | 4441 | break; |
@@ -4489,7 +4490,7 @@ zoran_mmap (struct file *file, | |||
4489 | case ZORAN_MAP_MODE_JPG_PLAY: | 4490 | case ZORAN_MAP_MODE_JPG_PLAY: |
4490 | 4491 | ||
4491 | /* lock */ | 4492 | /* lock */ |
4492 | down(&zr->resource_lock); | 4493 | mutex_lock(&zr->resource_lock); |
4493 | 4494 | ||
4494 | /* Map the MJPEG buffers */ | 4495 | /* Map the MJPEG buffers */ |
4495 | if (!fh->jpg_buffers.allocated) { | 4496 | if (!fh->jpg_buffers.allocated) { |
@@ -4579,13 +4580,13 @@ zoran_mmap (struct file *file, | |||
4579 | 4580 | ||
4580 | } | 4581 | } |
4581 | jpg_mmap_unlock_and_return: | 4582 | jpg_mmap_unlock_and_return: |
4582 | up(&zr->resource_lock); | 4583 | mutex_unlock(&zr->resource_lock); |
4583 | 4584 | ||
4584 | break; | 4585 | break; |
4585 | 4586 | ||
4586 | case ZORAN_MAP_MODE_RAW: | 4587 | case ZORAN_MAP_MODE_RAW: |
4587 | 4588 | ||
4588 | down(&zr->resource_lock); | 4589 | mutex_lock(&zr->resource_lock); |
4589 | 4590 | ||
4590 | /* Map the V4L buffers */ | 4591 | /* Map the V4L buffers */ |
4591 | if (!fh->v4l_buffers.allocated) { | 4592 | if (!fh->v4l_buffers.allocated) { |
@@ -4657,7 +4658,7 @@ zoran_mmap (struct file *file, | |||
4657 | break; | 4658 | break; |
4658 | } | 4659 | } |
4659 | v4l_mmap_unlock_and_return: | 4660 | v4l_mmap_unlock_and_return: |
4660 | up(&zr->resource_lock); | 4661 | mutex_unlock(&zr->resource_lock); |
4661 | 4662 | ||
4662 | break; | 4663 | break; |
4663 | 4664 | ||