diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-03 04:14:34 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-04-06 20:44:01 -0400 |
commit | 84b5dbf39ed2f51224841bbbf08439158d69d427 (patch) | |
tree | b24963462dc1ad93860645d8729d1ddfc6ce526e /drivers/media/video/cx231xx/cx231xx-audio.c | |
parent | e0d3bafd02586cfde286c320f56906fd9fa8d256 (diff) |
V4L/DVB (10955): cx231xx: CodingStyle automatic fixes with Lindent
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx231xx/cx231xx-audio.c')
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-audio.c | 255 |
1 files changed, 129 insertions, 126 deletions
diff --git a/drivers/media/video/cx231xx/cx231xx-audio.c b/drivers/media/video/cx231xx/cx231xx-audio.c index e4335e2a4103..cee64879c4f0 100644 --- a/drivers/media/video/cx231xx/cx231xx-audio.c +++ b/drivers/media/video/cx231xx/cx231xx-audio.c | |||
@@ -58,21 +58,20 @@ static int cx231xx_isoc_audio_deinit(struct cx231xx *dev) | |||
58 | 58 | ||
59 | dprintk("Stopping isoc\n"); | 59 | dprintk("Stopping isoc\n"); |
60 | 60 | ||
61 | |||
62 | for (i = 0; i < CX231XX_AUDIO_BUFS; i++) { | 61 | for (i = 0; i < CX231XX_AUDIO_BUFS; i++) { |
63 | if(dev->adev.urb[i]) { | 62 | if (dev->adev.urb[i]) { |
64 | if (!irqs_disabled()) | 63 | if (!irqs_disabled()) |
65 | usb_kill_urb(dev->adev.urb[i]); | 64 | usb_kill_urb(dev->adev.urb[i]); |
66 | else | 65 | else |
67 | usb_unlink_urb(dev->adev.urb[i]); | 66 | usb_unlink_urb(dev->adev.urb[i]); |
68 | 67 | ||
69 | usb_free_urb(dev->adev.urb[i]); | 68 | usb_free_urb(dev->adev.urb[i]); |
70 | dev->adev.urb[i] = NULL; | 69 | dev->adev.urb[i] = NULL; |
71 | 70 | ||
72 | kfree(dev->adev.transfer_buffer[i]); | 71 | kfree(dev->adev.transfer_buffer[i]); |
73 | dev->adev.transfer_buffer[i] = NULL; | 72 | dev->adev.transfer_buffer[i] = NULL; |
74 | 73 | ||
75 | } | 74 | } |
76 | } | 75 | } |
77 | 76 | ||
78 | return 0; | 77 | return 0; |
@@ -80,27 +79,27 @@ static int cx231xx_isoc_audio_deinit(struct cx231xx *dev) | |||
80 | 79 | ||
81 | static void cx231xx_audio_isocirq(struct urb *urb) | 80 | static void cx231xx_audio_isocirq(struct urb *urb) |
82 | { | 81 | { |
83 | struct cx231xx *dev = urb->context; | 82 | struct cx231xx *dev = urb->context; |
84 | int i; | 83 | int i; |
85 | unsigned int oldptr; | 84 | unsigned int oldptr; |
86 | int period_elapsed = 0; | 85 | int period_elapsed = 0; |
87 | int status; | 86 | int status; |
88 | unsigned char *cp; | 87 | unsigned char *cp; |
89 | unsigned int stride; | 88 | unsigned int stride; |
90 | struct snd_pcm_substream *substream; | 89 | struct snd_pcm_substream *substream; |
91 | struct snd_pcm_runtime *runtime; | 90 | struct snd_pcm_runtime *runtime; |
92 | 91 | ||
93 | switch (urb->status) { | 92 | switch (urb->status) { |
94 | case 0: /* success */ | 93 | case 0: /* success */ |
95 | case -ETIMEDOUT: /* NAK */ | 94 | case -ETIMEDOUT: /* NAK */ |
96 | break; | 95 | break; |
97 | case -ECONNRESET: /* kill */ | 96 | case -ECONNRESET: /* kill */ |
98 | case -ENOENT: | 97 | case -ENOENT: |
99 | case -ESHUTDOWN: | 98 | case -ESHUTDOWN: |
100 | return; | 99 | return; |
101 | default: /* error */ | 100 | default: /* error */ |
102 | dprintk("urb completition error %d.\n", urb->status); | 101 | dprintk("urb completition error %d.\n", urb->status); |
103 | break; | 102 | break; |
104 | } | 103 | } |
105 | 104 | ||
106 | if (dev->adev.capture_pcm_substream) { | 105 | if (dev->adev.capture_pcm_substream) { |
@@ -145,7 +144,6 @@ static void cx231xx_audio_isocirq(struct urb *urb) | |||
145 | runtime->period_size; | 144 | runtime->period_size; |
146 | period_elapsed = 1; | 145 | period_elapsed = 1; |
147 | } | 146 | } |
148 | |||
149 | snd_pcm_stream_unlock(substream); | 147 | snd_pcm_stream_unlock(substream); |
150 | } | 148 | } |
151 | if (period_elapsed) | 149 | if (period_elapsed) |
@@ -156,19 +154,19 @@ static void cx231xx_audio_isocirq(struct urb *urb) | |||
156 | status = usb_submit_urb(urb, GFP_ATOMIC); | 154 | status = usb_submit_urb(urb, GFP_ATOMIC); |
157 | if (status < 0) { | 155 | if (status < 0) { |
158 | cx231xx_errdev("resubmit of audio urb failed (error=%i)\n", | 156 | cx231xx_errdev("resubmit of audio urb failed (error=%i)\n", |
159 | status); | 157 | status); |
160 | } | 158 | } |
161 | return; | 159 | return; |
162 | } | 160 | } |
163 | 161 | ||
164 | static int cx231xx_init_audio_isoc(struct cx231xx *dev) | 162 | static int cx231xx_init_audio_isoc(struct cx231xx *dev) |
165 | { | 163 | { |
166 | int i, errCode; | 164 | int i, errCode; |
167 | int sb_size; | 165 | int sb_size; |
168 | 166 | ||
169 | cx231xx_info("%s: Starting AUDIO transfers\n",__func__); | 167 | cx231xx_info("%s: Starting AUDIO transfers\n", __func__); |
170 | 168 | ||
171 | sb_size = CX231XX_NUM_AUDIO_PACKETS * dev->adev.max_pkt_size; | 169 | sb_size = CX231XX_NUM_AUDIO_PACKETS * dev->adev.max_pkt_size; |
172 | 170 | ||
173 | for (i = 0; i < CX231XX_AUDIO_BUFS; i++) { | 171 | for (i = 0; i < CX231XX_AUDIO_BUFS; i++) { |
174 | struct urb *urb; | 172 | struct urb *urb; |
@@ -191,7 +189,8 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev) | |||
191 | 189 | ||
192 | urb->dev = dev->udev; | 190 | urb->dev = dev->udev; |
193 | urb->context = dev; | 191 | urb->context = dev; |
194 | urb->pipe = usb_rcvisocpipe(dev->udev, dev->adev.end_point_addr); | 192 | urb->pipe = |
193 | usb_rcvisocpipe(dev->udev, dev->adev.end_point_addr); | ||
195 | urb->transfer_flags = URB_ISO_ASAP; | 194 | urb->transfer_flags = URB_ISO_ASAP; |
196 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; | 195 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; |
197 | urb->interval = 1; | 196 | urb->interval = 1; |
@@ -200,10 +199,9 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev) | |||
200 | urb->transfer_buffer_length = sb_size; | 199 | urb->transfer_buffer_length = sb_size; |
201 | 200 | ||
202 | for (j = k = 0; j < CX231XX_NUM_AUDIO_PACKETS; | 201 | for (j = k = 0; j < CX231XX_NUM_AUDIO_PACKETS; |
203 | j++, k += dev->adev.max_pkt_size) { | 202 | j++, k += dev->adev.max_pkt_size) { |
204 | urb->iso_frame_desc[j].offset = k; | 203 | urb->iso_frame_desc[j].offset = k; |
205 | urb->iso_frame_desc[j].length = | 204 | urb->iso_frame_desc[j].length = dev->adev.max_pkt_size; |
206 | dev->adev.max_pkt_size; | ||
207 | } | 205 | } |
208 | dev->adev.urb[i] = urb; | 206 | dev->adev.urb[i] = urb; |
209 | } | 207 | } |
@@ -221,11 +219,11 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev) | |||
221 | 219 | ||
222 | static int cx231xx_cmd(struct cx231xx *dev, int cmd, int arg) | 220 | static int cx231xx_cmd(struct cx231xx *dev, int cmd, int arg) |
223 | { | 221 | { |
224 | dprintk("%s transfer\n", (dev->adev.capture_stream == STREAM_ON)? | 222 | dprintk("%s transfer\n", (dev->adev.capture_stream == STREAM_ON) ? |
225 | "stop" : "start"); | 223 | "stop" : "start"); |
226 | 224 | ||
227 | switch (cmd) { | 225 | switch (cmd) { |
228 | case CX231XX_CAPTURE_STREAM_EN: | 226 | case CX231XX_CAPTURE_STREAM_EN: |
229 | if (dev->adev.capture_stream == STREAM_OFF && arg == 1) { | 227 | if (dev->adev.capture_stream == STREAM_OFF && arg == 1) { |
230 | dev->adev.capture_stream = STREAM_ON; | 228 | dev->adev.capture_stream = STREAM_ON; |
231 | cx231xx_init_audio_isoc(dev); | 229 | cx231xx_init_audio_isoc(dev); |
@@ -233,8 +231,8 @@ static int cx231xx_cmd(struct cx231xx *dev, int cmd, int arg) | |||
233 | dev->adev.capture_stream = STREAM_OFF; | 231 | dev->adev.capture_stream = STREAM_OFF; |
234 | cx231xx_isoc_audio_deinit(dev); | 232 | cx231xx_isoc_audio_deinit(dev); |
235 | } else { | 233 | } else { |
236 | cx231xx_errdev( "An underrun very likely occurred. " | 234 | cx231xx_errdev("An underrun very likely occurred. " |
237 | "Ignoring it.\n"); | 235 | "Ignoring it.\n"); |
238 | } | 236 | } |
239 | return 0; | 237 | return 0; |
240 | default: | 238 | default: |
@@ -265,9 +263,8 @@ static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, | |||
265 | 263 | ||
266 | static struct snd_pcm_hardware snd_cx231xx_hw_capture = { | 264 | static struct snd_pcm_hardware snd_cx231xx_hw_capture = { |
267 | .info = SNDRV_PCM_INFO_BLOCK_TRANSFER | | 265 | .info = SNDRV_PCM_INFO_BLOCK_TRANSFER | |
268 | SNDRV_PCM_INFO_MMAP | | 266 | SNDRV_PCM_INFO_MMAP | |
269 | SNDRV_PCM_INFO_INTERLEAVED | | 267 | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP_VALID, |
270 | SNDRV_PCM_INFO_MMAP_VALID, | ||
271 | 268 | ||
272 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | 269 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
273 | 270 | ||
@@ -278,10 +275,10 @@ static struct snd_pcm_hardware snd_cx231xx_hw_capture = { | |||
278 | .channels_min = 2, | 275 | .channels_min = 2, |
279 | .channels_max = 2, | 276 | .channels_max = 2, |
280 | .buffer_bytes_max = 62720 * 8, /* just about the value in usbaudio.c */ | 277 | .buffer_bytes_max = 62720 * 8, /* just about the value in usbaudio.c */ |
281 | .period_bytes_min = 64, /* 12544/2, */ | 278 | .period_bytes_min = 64, /* 12544/2, */ |
282 | .period_bytes_max = 12544, | 279 | .period_bytes_max = 12544, |
283 | .periods_min = 2, | 280 | .periods_min = 2, |
284 | .periods_max = 98, /* 12544, */ | 281 | .periods_max = 98, /* 12544, */ |
285 | }; | 282 | }; |
286 | 283 | ||
287 | static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream) | 284 | static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream) |
@@ -294,29 +291,29 @@ static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream) | |||
294 | 291 | ||
295 | if (!dev) { | 292 | if (!dev) { |
296 | cx231xx_errdev("BUG: cx231xx can't find device struct." | 293 | cx231xx_errdev("BUG: cx231xx can't find device struct." |
297 | " Can't proceed with open\n"); | 294 | " Can't proceed with open\n"); |
298 | return -ENODEV; | 295 | return -ENODEV; |
299 | } | 296 | } |
300 | 297 | ||
301 | /* Sets volume, mute, etc */ | 298 | /* Sets volume, mute, etc */ |
302 | dev->mute = 0; | 299 | dev->mute = 0; |
303 | 300 | ||
304 | /* set alternate setting for audio interface */ | 301 | /* set alternate setting for audio interface */ |
305 | ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 1); /* 1 - 48000 samples per sec */ | 302 | ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 1); /* 1 - 48000 samples per sec */ |
306 | if (ret < 0) { | 303 | if (ret < 0) { |
307 | cx231xx_errdev("failed to set alternate setting !\n"); | 304 | cx231xx_errdev("failed to set alternate setting !\n"); |
308 | 305 | ||
309 | return ret; | 306 | return ret; |
310 | } | 307 | } |
311 | 308 | ||
312 | /* inform hardware to start streaming */ | 309 | /* inform hardware to start streaming */ |
313 | ret = cx231xx_capture_start(dev, 1, Audio); | 310 | ret = cx231xx_capture_start(dev, 1, Audio); |
314 | 311 | ||
315 | runtime->hw = snd_cx231xx_hw_capture; | 312 | runtime->hw = snd_cx231xx_hw_capture; |
316 | 313 | ||
317 | mutex_lock(&dev->lock); | 314 | mutex_lock(&dev->lock); |
318 | dev->adev.users++; | 315 | dev->adev.users++; |
319 | mutex_unlock(&dev->lock); | 316 | mutex_unlock(&dev->lock); |
320 | 317 | ||
321 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); | 318 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); |
322 | dev->adev.capture_pcm_substream = substream; | 319 | dev->adev.capture_pcm_substream = substream; |
@@ -327,26 +324,25 @@ static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream) | |||
327 | 324 | ||
328 | static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream) | 325 | static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream) |
329 | { | 326 | { |
330 | int ret; | 327 | int ret; |
331 | struct cx231xx *dev = snd_pcm_substream_chip(substream); | 328 | struct cx231xx *dev = snd_pcm_substream_chip(substream); |
332 | 329 | ||
333 | |||
334 | dprintk("closing device\n"); | 330 | dprintk("closing device\n"); |
335 | 331 | ||
336 | /* set alternate setting for audio interface */ | 332 | /* set alternate setting for audio interface */ |
337 | ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 0); /* 1 - 48000 samples per sec */ | 333 | ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 0); /* 1 - 48000 samples per sec */ |
338 | if (ret < 0) { | 334 | if (ret < 0) { |
339 | cx231xx_errdev("failed to set alternate setting !\n"); | 335 | cx231xx_errdev("failed to set alternate setting !\n"); |
340 | 336 | ||
341 | return ret; | 337 | return ret; |
342 | } | 338 | } |
343 | 339 | ||
344 | /* inform hardware to start streaming */ | 340 | /* inform hardware to start streaming */ |
345 | ret = cx231xx_capture_start(dev, 0, Audio); | 341 | ret = cx231xx_capture_start(dev, 0, Audio); |
346 | 342 | ||
347 | dev->mute = 1; | 343 | dev->mute = 1; |
348 | mutex_lock(&dev->lock); | 344 | mutex_lock(&dev->lock); |
349 | dev->adev.users--; | 345 | dev->adev.users--; |
350 | mutex_unlock(&dev->lock); | 346 | mutex_unlock(&dev->lock); |
351 | 347 | ||
352 | if (dev->adev.users == 0 && dev->adev.shutdown == 1) { | 348 | if (dev->adev.users == 0 && dev->adev.shutdown == 1) { |
@@ -360,7 +356,7 @@ static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream) | |||
360 | } | 356 | } |
361 | 357 | ||
362 | static int snd_cx231xx_hw_capture_params(struct snd_pcm_substream *substream, | 358 | static int snd_cx231xx_hw_capture_params(struct snd_pcm_substream *substream, |
363 | struct snd_pcm_hw_params *hw_params) | 359 | struct snd_pcm_hw_params *hw_params) |
364 | { | 360 | { |
365 | unsigned int channels, rate, format; | 361 | unsigned int channels, rate, format; |
366 | int ret; | 362 | int ret; |
@@ -368,7 +364,7 @@ static int snd_cx231xx_hw_capture_params(struct snd_pcm_substream *substream, | |||
368 | dprintk("Setting capture parameters\n"); | 364 | dprintk("Setting capture parameters\n"); |
369 | 365 | ||
370 | ret = snd_pcm_alloc_vmalloc_buffer(substream, | 366 | ret = snd_pcm_alloc_vmalloc_buffer(substream, |
371 | params_buffer_bytes(hw_params)); | 367 | params_buffer_bytes(hw_params)); |
372 | format = params_format(hw_params); | 368 | format = params_format(hw_params); |
373 | rate = params_rate(hw_params); | 369 | rate = params_rate(hw_params); |
374 | channels = params_channels(hw_params); | 370 | channels = params_channels(hw_params); |
@@ -397,45 +393,45 @@ static int snd_cx231xx_prepare(struct snd_pcm_substream *substream) | |||
397 | } | 393 | } |
398 | 394 | ||
399 | static int snd_cx231xx_capture_trigger(struct snd_pcm_substream *substream, | 395 | static int snd_cx231xx_capture_trigger(struct snd_pcm_substream *substream, |
400 | int cmd) | 396 | int cmd) |
401 | { | 397 | { |
402 | struct cx231xx *dev = snd_pcm_substream_chip(substream); | 398 | struct cx231xx *dev = snd_pcm_substream_chip(substream); |
403 | int retval; | 399 | int retval; |
404 | 400 | ||
401 | dprintk("Should %s capture\n", (cmd == SNDRV_PCM_TRIGGER_START) ? | ||
402 | "start" : "stop"); | ||
405 | 403 | ||
406 | dprintk("Should %s capture\n", (cmd == SNDRV_PCM_TRIGGER_START)? | 404 | spin_lock(&dev->adev.slock); |
407 | "start": "stop"); | ||
408 | |||
409 | spin_lock(&dev->adev.slock); | ||
410 | switch (cmd) { | 405 | switch (cmd) { |
411 | case SNDRV_PCM_TRIGGER_START: | 406 | case SNDRV_PCM_TRIGGER_START: |
412 | cx231xx_cmd(dev, CX231XX_CAPTURE_STREAM_EN, CX231XX_START_AUDIO); | 407 | cx231xx_cmd(dev, CX231XX_CAPTURE_STREAM_EN, |
408 | CX231XX_START_AUDIO); | ||
413 | retval = 0; | 409 | retval = 0; |
414 | break; | 410 | break; |
415 | case SNDRV_PCM_TRIGGER_STOP: | 411 | case SNDRV_PCM_TRIGGER_STOP: |
416 | cx231xx_cmd(dev, CX231XX_CAPTURE_STREAM_EN, CX231XX_STOP_AUDIO); | 412 | cx231xx_cmd(dev, CX231XX_CAPTURE_STREAM_EN, CX231XX_STOP_AUDIO); |
417 | retval = 0; | 413 | retval = 0; |
418 | break; | 414 | break; |
419 | default: | 415 | default: |
420 | retval = -EINVAL; | 416 | retval = -EINVAL; |
421 | } | 417 | } |
422 | 418 | ||
423 | spin_unlock(&dev->adev.slock); | 419 | spin_unlock(&dev->adev.slock); |
424 | return retval; | 420 | return retval; |
425 | } | 421 | } |
426 | 422 | ||
427 | static snd_pcm_uframes_t snd_cx231xx_capture_pointer(struct snd_pcm_substream | 423 | static snd_pcm_uframes_t snd_cx231xx_capture_pointer(struct snd_pcm_substream |
428 | *substream) | 424 | *substream) |
429 | { | 425 | { |
430 | struct cx231xx *dev; | 426 | struct cx231xx *dev; |
431 | unsigned long flags; | 427 | unsigned long flags; |
432 | snd_pcm_uframes_t hwptr_done; | 428 | snd_pcm_uframes_t hwptr_done; |
433 | 429 | ||
434 | dev = snd_pcm_substream_chip(substream); | 430 | dev = snd_pcm_substream_chip(substream); |
435 | 431 | ||
436 | spin_lock_irqsave(&dev->adev.slock, flags); | 432 | spin_lock_irqsave(&dev->adev.slock, flags); |
437 | hwptr_done = dev->adev.hwptr_done_capture; | 433 | hwptr_done = dev->adev.hwptr_done_capture; |
438 | spin_unlock_irqrestore(&dev->adev.slock, flags); | 434 | spin_unlock_irqrestore(&dev->adev.slock, flags); |
439 | 435 | ||
440 | return hwptr_done; | 436 | return hwptr_done; |
441 | } | 437 | } |
@@ -449,26 +445,26 @@ static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs, | |||
449 | } | 445 | } |
450 | 446 | ||
451 | static struct snd_pcm_ops snd_cx231xx_pcm_capture = { | 447 | static struct snd_pcm_ops snd_cx231xx_pcm_capture = { |
452 | .open = snd_cx231xx_capture_open, | 448 | .open = snd_cx231xx_capture_open, |
453 | .close = snd_cx231xx_pcm_close, | 449 | .close = snd_cx231xx_pcm_close, |
454 | .ioctl = snd_pcm_lib_ioctl, | 450 | .ioctl = snd_pcm_lib_ioctl, |
455 | .hw_params = snd_cx231xx_hw_capture_params, | 451 | .hw_params = snd_cx231xx_hw_capture_params, |
456 | .hw_free = snd_cx231xx_hw_capture_free, | 452 | .hw_free = snd_cx231xx_hw_capture_free, |
457 | .prepare = snd_cx231xx_prepare, | 453 | .prepare = snd_cx231xx_prepare, |
458 | .trigger = snd_cx231xx_capture_trigger, | 454 | .trigger = snd_cx231xx_capture_trigger, |
459 | .pointer = snd_cx231xx_capture_pointer, | 455 | .pointer = snd_cx231xx_capture_pointer, |
460 | .page = snd_pcm_get_vmalloc_page, | 456 | .page = snd_pcm_get_vmalloc_page, |
461 | }; | 457 | }; |
462 | 458 | ||
463 | static int cx231xx_audio_init(struct cx231xx *dev) | 459 | static int cx231xx_audio_init(struct cx231xx *dev) |
464 | { | 460 | { |
465 | struct cx231xx_audio *adev = &dev->adev; | 461 | struct cx231xx_audio *adev = &dev->adev; |
466 | struct snd_pcm *pcm; | 462 | struct snd_pcm *pcm; |
467 | struct snd_card *card; | 463 | struct snd_card *card; |
468 | static int devnr; | 464 | static int devnr; |
469 | int err; | 465 | int err; |
470 | struct usb_interface *uif; | 466 | struct usb_interface *uif; |
471 | int i, isoc_pipe = 0; | 467 | int i, isoc_pipe = 0; |
472 | 468 | ||
473 | if (dev->has_alsa_audio != 1) { | 469 | if (dev->has_alsa_audio != 1) { |
474 | /* This device does not support the extension (in this case | 470 | /* This device does not support the extension (in this case |
@@ -478,7 +474,7 @@ static int cx231xx_audio_init(struct cx231xx *dev) | |||
478 | } | 474 | } |
479 | 475 | ||
480 | cx231xx_info("cx231xx-audio.c: probing for cx231xx " | 476 | cx231xx_info("cx231xx-audio.c: probing for cx231xx " |
481 | "non standard usbaudio\n"); | 477 | "non standard usbaudio\n"); |
482 | 478 | ||
483 | card = snd_card_new(index[devnr], "Cx231xx Audio", THIS_MODULE, 0); | 479 | card = snd_card_new(index[devnr], "Cx231xx Audio", THIS_MODULE, 0); |
484 | if (card == NULL) { | 480 | if (card == NULL) { |
@@ -492,7 +488,8 @@ static int cx231xx_audio_init(struct cx231xx *dev) | |||
492 | return err; | 488 | return err; |
493 | } | 489 | } |
494 | 490 | ||
495 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_cx231xx_pcm_capture); | 491 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, |
492 | &snd_cx231xx_pcm_capture); | ||
496 | pcm->info_flags = 0; | 493 | pcm->info_flags = 0; |
497 | pcm->private_data = dev; | 494 | pcm->private_data = dev; |
498 | strcpy(pcm->name, "Conexant cx231xx Capture"); | 495 | strcpy(pcm->name, "Conexant cx231xx Capture"); |
@@ -508,29 +505,35 @@ static int cx231xx_audio_init(struct cx231xx *dev) | |||
508 | adev->sndcard = card; | 505 | adev->sndcard = card; |
509 | adev->udev = dev->udev; | 506 | adev->udev = dev->udev; |
510 | 507 | ||
511 | /* compute alternate max packet sizes for Audio */ | 508 | /* compute alternate max packet sizes for Audio */ |
512 | uif = dev->udev->actconfig->interface[dev->current_pcb_config.hs_config_info[0].interface_info.audio_index+1]; | 509 | uif = |
510 | dev->udev->actconfig->interface[dev->current_pcb_config. | ||
511 | hs_config_info[0].interface_info. | ||
512 | audio_index + 1]; | ||
513 | 513 | ||
514 | adev->end_point_addr = le16_to_cpu(uif->altsetting[0].endpoint[isoc_pipe].desc.bEndpointAddress); | 514 | adev->end_point_addr = |
515 | le16_to_cpu(uif->altsetting[0].endpoint[isoc_pipe].desc. | ||
516 | bEndpointAddress); | ||
515 | 517 | ||
516 | adev->num_alt = uif->num_altsetting; | 518 | adev->num_alt = uif->num_altsetting; |
517 | cx231xx_info(": EndPoint Addr 0x%x, Alternate settings: %i\n", adev->end_point_addr, | 519 | cx231xx_info(": EndPoint Addr 0x%x, Alternate settings: %i\n", |
518 | adev->num_alt); | 520 | adev->end_point_addr, adev->num_alt); |
519 | adev->alt_max_pkt_size = kmalloc(32 * adev->num_alt, GFP_KERNEL); | 521 | adev->alt_max_pkt_size = kmalloc(32 * adev->num_alt, GFP_KERNEL); |
520 | 522 | ||
521 | if (adev->alt_max_pkt_size == NULL) { | 523 | if (adev->alt_max_pkt_size == NULL) { |
522 | cx231xx_errdev("out of memory!\n"); | 524 | cx231xx_errdev("out of memory!\n"); |
523 | return -ENOMEM; | 525 | return -ENOMEM; |
524 | } | 526 | } |
525 | 527 | ||
526 | for (i = 0; i < adev->num_alt ; i++) { | 528 | for (i = 0; i < adev->num_alt; i++) { |
527 | u16 tmp = le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].desc. | 529 | u16 tmp = |
528 | wMaxPacketSize); | 530 | le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].desc. |
529 | adev->alt_max_pkt_size[i] = | 531 | wMaxPacketSize); |
530 | (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); | 532 | adev->alt_max_pkt_size[i] = |
531 | cx231xx_info("Alternate setting %i, max size= %i\n", i, | 533 | (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); |
532 | adev->alt_max_pkt_size[i]); | 534 | cx231xx_info("Alternate setting %i, max size= %i\n", i, |
533 | } | 535 | adev->alt_max_pkt_size[i]); |
536 | } | ||
534 | 537 | ||
535 | return 0; | 538 | return 0; |
536 | } | 539 | } |
@@ -549,7 +552,7 @@ static int cx231xx_audio_fini(struct cx231xx *dev) | |||
549 | 552 | ||
550 | if (dev->adev.sndcard) { | 553 | if (dev->adev.sndcard) { |
551 | snd_card_free(dev->adev.sndcard); | 554 | snd_card_free(dev->adev.sndcard); |
552 | kfree(dev->adev.alt_max_pkt_size); | 555 | kfree(dev->adev.alt_max_pkt_size); |
553 | dev->adev.sndcard = NULL; | 556 | dev->adev.sndcard = NULL; |
554 | } | 557 | } |
555 | 558 | ||
@@ -557,7 +560,7 @@ static int cx231xx_audio_fini(struct cx231xx *dev) | |||
557 | } | 560 | } |
558 | 561 | ||
559 | static struct cx231xx_ops audio_ops = { | 562 | static struct cx231xx_ops audio_ops = { |
560 | .id = CX231XX_AUDIO, | 563 | .id = CX231XX_AUDIO, |
561 | .name = "Cx231xx Audio Extension", | 564 | .name = "Cx231xx Audio Extension", |
562 | .init = cx231xx_audio_init, | 565 | .init = cx231xx_audio_init, |
563 | .fini = cx231xx_audio_fini, | 566 | .fini = cx231xx_audio_fini, |