Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
ALSA: hda - Fix the cmd cache keys for amp verbs
ALSA: add missing definitions(letters) to HD-Audio.txt
ALSA: hda - Add quirk mask for Fujitsu Amilo laptops with ALC883
[ALSA] intel8x0: add one retry to the ac97_clock measurement routine
[ALSA] intel8x0: fix wrong conditions in ac97_clock measure routine
ALSA: hda - Avoid call of snd_jack_report at release
ALSA: add private_data to struct snd_jack
ALSA: snd-usb-caiaq: rename files to remove redundant information in file pathes
ALSA: snd-usb-caiaq: clean up header includes
ALSA: sound/pci: use memdup_user()
ALSA: sound/usb: use memdup_user()
ALSA: sound/isa: use memdup_user()
ALSA: sound/core: use memdup_user()
[ALSA] intel8x0: do not use zero value from PICB register
[ALSA] intel8x0: an attempt to make ac97_clock measurement more reliable
[ALSA] pcm-midlevel: Add more strict buffer position checks based on jiffies
[ALSA] hda_intel: fix unexpected ring buffer positions
ASoC: Disable S3C64xx support in Kconfig
ASoC: magician: remove un-necessary #include of pxa-regs.h and hardware.h

+321 -283
+2 -2
Documentation/sound/alsa/HD-Audio.txt
··· 169 169 What `model` option values are available depends on the codec chip. 170 170 Check your codec chip from the codec proc file (see "Codec Proc-File" 171 171 section below). It will show the vendor/product name of your codec 172 - chip. Then, see Documentation/sound/alsa/HD-Audio-Modelstxt file, 172 + chip. Then, see Documentation/sound/alsa/HD-Audio-Models.txt file, 173 173 the section of HD-audio driver. You can find a list of codecs 174 174 and `model` options belonging to each codec. For example, for Realtek 175 175 ALC262 codec chip, pass `model=ultra` for devices that are compatible ··· 177 177 178 178 Thus, the first thing you can do for any brand-new, unsupported and 179 179 non-working HD-audio hardware is to check HD-audio codec and several 180 - different `model` option values. If you have a luck, some of them 180 + different `model` option values. If you have any luck, some of them 181 181 might suit with your device well. 182 182 183 183 Some codecs such as ALC880 have a special model option `model=test`.
+2
include/sound/jack.h
··· 50 50 int type; 51 51 const char *id; 52 52 char name[100]; 53 + void *private_data; 54 + void (*private_free)(struct snd_jack *); 53 55 }; 54 56 55 57 #ifdef CONFIG_SND_JACK
+2 -1
include/sound/pcm.h
··· 268 268 int overrange; 269 269 snd_pcm_uframes_t avail_max; 270 270 snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */ 271 - snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time*/ 271 + snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time */ 272 + unsigned long hw_ptr_jiffies; /* Time when hw_ptr is updated */ 272 273 273 274 /* -- HW params -- */ 274 275 snd_pcm_access_t access; /* access mode */
+13 -22
sound/core/control.c
··· 723 723 { 724 724 struct snd_ctl_elem_value *control; 725 725 int result; 726 - 727 - control = kmalloc(sizeof(*control), GFP_KERNEL); 728 - if (control == NULL) 729 - return -ENOMEM; 730 - if (copy_from_user(control, _control, sizeof(*control))) { 731 - kfree(control); 732 - return -EFAULT; 733 - } 726 + 727 + control = memdup_user(_control, sizeof(*control)); 728 + if (IS_ERR(control)) 729 + return PTR_ERR(control); 730 + 734 731 snd_power_lock(card); 735 732 result = snd_power_wait(card, SNDRV_CTL_POWER_D0); 736 733 if (result >= 0) ··· 781 784 struct snd_card *card; 782 785 int result; 783 786 784 - control = kmalloc(sizeof(*control), GFP_KERNEL); 785 - if (control == NULL) 786 - return -ENOMEM; 787 - if (copy_from_user(control, _control, sizeof(*control))) { 788 - kfree(control); 789 - return -EFAULT; 790 - } 787 + control = memdup_user(_control, sizeof(*control)); 788 + if (IS_ERR(control)) 789 + return PTR_ERR(control); 790 + 791 791 card = file->card; 792 792 snd_power_lock(card); 793 793 result = snd_power_wait(card, SNDRV_CTL_POWER_D0); ··· 910 916 if (op_flag > 0) { 911 917 if (size > 1024 * 128) /* sane value */ 912 918 return -EINVAL; 913 - new_data = kmalloc(size, GFP_KERNEL); 914 - if (new_data == NULL) 915 - return -ENOMEM; 916 - if (copy_from_user(new_data, tlv, size)) { 917 - kfree(new_data); 918 - return -EFAULT; 919 - } 919 + 920 + new_data = memdup_user(tlv, size); 921 + if (IS_ERR(new_data)) 922 + return PTR_ERR(new_data); 920 923 change = ue->tlv_data_size != size; 921 924 if (!change) 922 925 change = memcmp(ue->tlv_data, new_data, size);
+3
sound/core/jack.c
··· 35 35 { 36 36 struct snd_jack *jack = device->device_data; 37 37 38 + if (jack->private_free) 39 + jack->private_free(jack); 40 + 38 41 /* If the input device is registered with the input subsystem 39 42 * then we need to use a different deallocator. */ 40 43 if (jack->registered)
+4 -7
sound/core/pcm_compat.c
··· 232 232 if (! (runtime = substream->runtime)) 233 233 return -ENOTTY; 234 234 235 - data = kmalloc(sizeof(*data), GFP_KERNEL); 236 - if (data == NULL) 237 - return -ENOMEM; 238 235 /* only fifo_size is different, so just copy all */ 239 - if (copy_from_user(data, data32, sizeof(*data32))) { 240 - err = -EFAULT; 241 - goto error; 242 - } 236 + data = memdup_user(data32, sizeof(*data32)); 237 + if (IS_ERR(data)) 238 + return PTR_ERR(data); 239 + 243 240 if (refine) 244 241 err = snd_pcm_hw_refine(substream, data); 245 242 else
+39 -8
sound/core/pcm_lib.c
··· 209 209 { 210 210 struct snd_pcm_runtime *runtime = substream->runtime; 211 211 snd_pcm_uframes_t pos; 212 - snd_pcm_uframes_t new_hw_ptr, hw_ptr_interrupt, hw_base; 213 - snd_pcm_sframes_t delta; 212 + snd_pcm_uframes_t old_hw_ptr, new_hw_ptr, hw_ptr_interrupt, hw_base; 213 + snd_pcm_sframes_t hdelta, delta; 214 + unsigned long jdelta; 214 215 216 + old_hw_ptr = runtime->status->hw_ptr; 215 217 pos = snd_pcm_update_hw_ptr_pos(substream, runtime); 216 218 if (pos == SNDRV_PCM_POS_XRUN) { 217 219 xrun(substream); ··· 249 247 new_hw_ptr = hw_base + pos; 250 248 } 251 249 } 252 - if (delta > runtime->period_size) { 250 + hdelta = new_hw_ptr - old_hw_ptr; 251 + jdelta = jiffies - runtime->hw_ptr_jiffies; 252 + if (((hdelta * HZ) / runtime->rate) > jdelta + HZ/100) { 253 + delta = jdelta / 254 + (((runtime->period_size * HZ) / runtime->rate) 255 + + HZ/100); 256 + hw_ptr_error(substream, 257 + "hw_ptr skipping! [Q] " 258 + "(pos=%ld, delta=%ld, period=%ld, " 259 + "jdelta=%lu/%lu/%lu)\n", 260 + (long)pos, (long)hdelta, 261 + (long)runtime->period_size, jdelta, 262 + ((hdelta * HZ) / runtime->rate), delta); 263 + hw_ptr_interrupt = runtime->hw_ptr_interrupt + 264 + runtime->period_size * delta; 265 + if (hw_ptr_interrupt >= runtime->boundary) 266 + hw_ptr_interrupt -= runtime->boundary; 267 + /* rebase to interrupt position */ 268 + hw_base = new_hw_ptr = hw_ptr_interrupt; 269 + /* align hw_base to buffer_size */ 270 + hw_base -= hw_base % runtime->buffer_size; 271 + delta = 0; 272 + } 273 + if (delta > runtime->period_size + runtime->period_size / 2) { 253 274 hw_ptr_error(substream, 254 275 "Lost interrupts? " 255 276 "(stream=%i, delta=%ld, intr_ptr=%ld)\n", ··· 288 263 289 264 runtime->hw_ptr_base = hw_base; 290 265 runtime->status->hw_ptr = new_hw_ptr; 266 + runtime->hw_ptr_jiffies = jiffies; 291 267 runtime->hw_ptr_interrupt = hw_ptr_interrupt; 292 268 293 269 return snd_pcm_update_hw_ptr_post(substream, runtime); ··· 301 275 snd_pcm_uframes_t pos; 302 276 snd_pcm_uframes_t old_hw_ptr, new_hw_ptr, hw_base; 303 277 snd_pcm_sframes_t delta; 278 + unsigned long jdelta; 304 279 305 280 old_hw_ptr = runtime->status->hw_ptr; 306 281 pos = snd_pcm_update_hw_ptr_pos(substream, runtime); ··· 313 286 new_hw_ptr = hw_base + pos; 314 287 315 288 delta = new_hw_ptr - old_hw_ptr; 289 + jdelta = jiffies - runtime->hw_ptr_jiffies; 316 290 if (delta < 0) { 317 291 delta += runtime->buffer_size; 318 292 if (delta < 0) { 319 293 hw_ptr_error(substream, 320 294 "Unexpected hw_pointer value [2] " 321 - "(stream=%i, pos=%ld, old_ptr=%ld)\n", 295 + "(stream=%i, pos=%ld, old_ptr=%ld, jdelta=%li)\n", 322 296 substream->stream, (long)pos, 323 - (long)old_hw_ptr); 297 + (long)old_hw_ptr, jdelta); 324 298 return 0; 325 299 } 326 300 hw_base += runtime->buffer_size; ··· 329 301 hw_base = 0; 330 302 new_hw_ptr = hw_base + pos; 331 303 } 332 - if (delta > runtime->period_size && runtime->periods > 1) { 304 + if (((delta * HZ) / runtime->rate) > jdelta + HZ/100) { 333 305 hw_ptr_error(substream, 334 306 "hw_ptr skipping! " 335 - "(pos=%ld, delta=%ld, period=%ld)\n", 307 + "(pos=%ld, delta=%ld, period=%ld, jdelta=%lu/%lu)\n", 336 308 (long)pos, (long)delta, 337 - (long)runtime->period_size); 309 + (long)runtime->period_size, jdelta, 310 + ((delta * HZ) / runtime->rate)); 338 311 return 0; 339 312 } 340 313 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && ··· 344 315 345 316 runtime->hw_ptr_base = hw_base; 346 317 runtime->status->hw_ptr = new_hw_ptr; 318 + runtime->hw_ptr_jiffies = jiffies; 347 319 348 320 return snd_pcm_update_hw_ptr_post(substream, runtime); 349 321 } ··· 1471 1441 runtime->status->hw_ptr %= runtime->buffer_size; 1472 1442 else 1473 1443 runtime->status->hw_ptr = 0; 1444 + runtime->hw_ptr_jiffies = jiffies; 1474 1445 snd_pcm_stream_unlock_irqrestore(substream, flags); 1475 1446 return 0; 1476 1447 }
+35 -58
sound/core/pcm_native.c
··· 327 327 struct snd_pcm_hw_params *params; 328 328 int err; 329 329 330 - params = kmalloc(sizeof(*params), GFP_KERNEL); 331 - if (!params) { 332 - err = -ENOMEM; 333 - goto out; 334 - } 335 - if (copy_from_user(params, _params, sizeof(*params))) { 336 - err = -EFAULT; 337 - goto out; 338 - } 330 + params = memdup_user(_params, sizeof(*params)); 331 + if (IS_ERR(params)) 332 + return PTR_ERR(params); 333 + 339 334 err = snd_pcm_hw_refine(substream, params); 340 335 if (copy_to_user(_params, params, sizeof(*params))) { 341 336 if (!err) 342 337 err = -EFAULT; 343 338 } 344 - out: 339 + 345 340 kfree(params); 346 341 return err; 347 342 } ··· 460 465 struct snd_pcm_hw_params *params; 461 466 int err; 462 467 463 - params = kmalloc(sizeof(*params), GFP_KERNEL); 464 - if (!params) { 465 - err = -ENOMEM; 466 - goto out; 467 - } 468 - if (copy_from_user(params, _params, sizeof(*params))) { 469 - err = -EFAULT; 470 - goto out; 471 - } 468 + params = memdup_user(_params, sizeof(*params)); 469 + if (IS_ERR(params)) 470 + return PTR_ERR(params); 471 + 472 472 err = snd_pcm_hw_params(substream, params); 473 473 if (copy_to_user(_params, params, sizeof(*params))) { 474 474 if (!err) 475 475 err = -EFAULT; 476 476 } 477 - out: 477 + 478 478 kfree(params); 479 479 return err; 480 480 } ··· 2583 2593 return -EFAULT; 2584 2594 if (copy_from_user(&xfern, _xfern, sizeof(xfern))) 2585 2595 return -EFAULT; 2586 - bufs = kmalloc(sizeof(void *) * runtime->channels, GFP_KERNEL); 2587 - if (bufs == NULL) 2588 - return -ENOMEM; 2589 - if (copy_from_user(bufs, xfern.bufs, sizeof(void *) * runtime->channels)) { 2590 - kfree(bufs); 2591 - return -EFAULT; 2592 - } 2596 + 2597 + bufs = memdup_user(xfern.bufs, 2598 + sizeof(void *) * runtime->channels); 2599 + if (IS_ERR(bufs)) 2600 + return PTR_ERR(bufs); 2593 2601 result = snd_pcm_lib_writev(substream, bufs, xfern.frames); 2594 2602 kfree(bufs); 2595 2603 __put_user(result, &_xfern->result); ··· 2663 2675 return -EFAULT; 2664 2676 if (copy_from_user(&xfern, _xfern, sizeof(xfern))) 2665 2677 return -EFAULT; 2666 - bufs = kmalloc(sizeof(void *) * runtime->channels, GFP_KERNEL); 2667 - if (bufs == NULL) 2668 - return -ENOMEM; 2669 - if (copy_from_user(bufs, xfern.bufs, sizeof(void *) * runtime->channels)) { 2670 - kfree(bufs); 2671 - return -EFAULT; 2672 - } 2678 + 2679 + bufs = memdup_user(xfern.bufs, 2680 + sizeof(void *) * runtime->channels); 2681 + if (IS_ERR(bufs)) 2682 + return PTR_ERR(bufs); 2673 2683 result = snd_pcm_lib_readv(substream, bufs, xfern.frames); 2674 2684 kfree(bufs); 2675 2685 __put_user(result, &_xfern->result); ··· 3298 3312 int err; 3299 3313 3300 3314 params = kmalloc(sizeof(*params), GFP_KERNEL); 3301 - if (!params) { 3302 - err = -ENOMEM; 3303 - goto out; 3304 - } 3305 - oparams = kmalloc(sizeof(*oparams), GFP_KERNEL); 3306 - if (!oparams) { 3307 - err = -ENOMEM; 3308 - goto out; 3309 - } 3315 + if (!params) 3316 + return -ENOMEM; 3310 3317 3311 - if (copy_from_user(oparams, _oparams, sizeof(*oparams))) { 3312 - err = -EFAULT; 3318 + oparams = memdup_user(_oparams, sizeof(*oparams)); 3319 + if (IS_ERR(oparams)) { 3320 + err = PTR_ERR(oparams); 3313 3321 goto out; 3314 3322 } 3315 3323 snd_pcm_hw_convert_from_old_params(params, oparams); ··· 3313 3333 if (!err) 3314 3334 err = -EFAULT; 3315 3335 } 3336 + 3337 + kfree(oparams); 3316 3338 out: 3317 3339 kfree(params); 3318 - kfree(oparams); 3319 3340 return err; 3320 3341 } 3321 3342 ··· 3328 3347 int err; 3329 3348 3330 3349 params = kmalloc(sizeof(*params), GFP_KERNEL); 3331 - if (!params) { 3332 - err = -ENOMEM; 3333 - goto out; 3334 - } 3335 - oparams = kmalloc(sizeof(*oparams), GFP_KERNEL); 3336 - if (!oparams) { 3337 - err = -ENOMEM; 3338 - goto out; 3339 - } 3340 - if (copy_from_user(oparams, _oparams, sizeof(*oparams))) { 3341 - err = -EFAULT; 3350 + if (!params) 3351 + return -ENOMEM; 3352 + 3353 + oparams = memdup_user(_oparams, sizeof(*oparams)); 3354 + if (IS_ERR(oparams)) { 3355 + err = PTR_ERR(oparams); 3342 3356 goto out; 3343 3357 } 3344 3358 snd_pcm_hw_convert_from_old_params(params, oparams); ··· 3343 3367 if (!err) 3344 3368 err = -EFAULT; 3345 3369 } 3370 + 3371 + kfree(oparams); 3346 3372 out: 3347 3373 kfree(params); 3348 - kfree(oparams); 3349 3374 return err; 3350 3375 } 3351 3376 #endif /* CONFIG_SND_SUPPORT_OLD_API */
+4 -5
sound/core/seq/seq_compat.c
··· 48 48 struct snd_seq_port_info *data; 49 49 mm_segment_t fs; 50 50 51 - data = kmalloc(sizeof(*data), GFP_KERNEL); 52 - if (! data) 53 - return -ENOMEM; 51 + data = memdup_user(data32, sizeof(*data32)); 52 + if (IS_ERR(data)) 53 + return PTR_ERR(data); 54 54 55 - if (copy_from_user(data, data32, sizeof(*data32)) || 56 - get_user(data->flags, &data32->flags) || 55 + if (get_user(data->flags, &data32->flags) || 57 56 get_user(data->time_queue, &data32->time_queue)) 58 57 goto error; 59 58 data->kernel = NULL;
+4 -7
sound/core/timer.c
··· 1395 1395 struct list_head *p; 1396 1396 int err = 0; 1397 1397 1398 - ginfo = kmalloc(sizeof(*ginfo), GFP_KERNEL); 1399 - if (! ginfo) 1400 - return -ENOMEM; 1401 - if (copy_from_user(ginfo, _ginfo, sizeof(*ginfo))) { 1402 - kfree(ginfo); 1403 - return -EFAULT; 1404 - } 1398 + ginfo = memdup_user(_ginfo, sizeof(*ginfo)); 1399 + if (IS_ERR(ginfo)) 1400 + return PTR_ERR(ginfo); 1401 + 1405 1402 tid = ginfo->tid; 1406 1403 memset(ginfo, 0, sizeof(*ginfo)); 1407 1404 ginfo->tid = tid;
+10 -9
sound/isa/sb/sb16_csp.c
··· 684 684 685 685 static int snd_sb_csp_load_user(struct snd_sb_csp * p, const unsigned char __user *buf, int size, int load_flags) 686 686 { 687 - int err = -ENOMEM; 688 - unsigned char *kbuf = kmalloc(size, GFP_KERNEL); 689 - if (kbuf) { 690 - if (copy_from_user(kbuf, buf, size)) 691 - err = -EFAULT; 692 - else 693 - err = snd_sb_csp_load(p, kbuf, size, load_flags); 694 - kfree(kbuf); 695 - } 687 + int err; 688 + unsigned char *kbuf; 689 + 690 + kbuf = memdup_user(buf, size); 691 + if (IS_ERR(kbuf)) 692 + return PTR_ERR(kbuf); 693 + 694 + err = snd_sb_csp_load(p, kbuf, size, load_flags); 695 + 696 + kfree(kbuf); 696 697 return err; 697 698 } 698 699
+5 -9
sound/isa/wavefront/wavefront_fx.c
··· 202 202 "> 512 bytes to FX\n"); 203 203 return -EIO; 204 204 } 205 - page_data = kmalloc(r.data[2] * sizeof(short), GFP_KERNEL); 206 - if (!page_data) 207 - return -ENOMEM; 208 - if (copy_from_user (page_data, 209 - (unsigned char __user *) r.data[3], 210 - r.data[2] * sizeof(short))) { 211 - kfree(page_data); 212 - return -EFAULT; 213 - } 205 + page_data = memdup_user((unsigned char __user *) 206 + r.data[3], 207 + r.data[2] * sizeof(short)); 208 + if (IS_ERR(page_data)) 209 + return PTR_ERR(page_data); 214 210 pd = page_data; 215 211 } 216 212
+5 -6
sound/isa/wavefront/wavefront_synth.c
··· 1664 1664 break; 1665 1665 1666 1666 case WFCTL_WFCMD: 1667 - wc = kmalloc(sizeof(*wc), GFP_KERNEL); 1668 - if (! wc) 1669 - return -ENOMEM; 1670 - if (copy_from_user (wc, argp, sizeof (*wc))) 1671 - err = -EFAULT; 1672 - else if (wavefront_synth_control (acard, wc) < 0) 1667 + wc = memdup_user(argp, sizeof(*wc)); 1668 + if (IS_ERR(wc)) 1669 + return PTR_ERR(wc); 1670 + 1671 + if (wavefront_synth_control (acard, wc) < 0) 1673 1672 err = -EIO; 1674 1673 else if (copy_to_user (argp, wc, sizeof (*wc))) 1675 1674 err = -EFAULT;
+13 -28
sound/pci/emu10k1/emufx.c
··· 2493 2493 case SNDRV_EMU10K1_IOCTL_CODE_POKE: 2494 2494 if (!capable(CAP_SYS_ADMIN)) 2495 2495 return -EPERM; 2496 - icode = kmalloc(sizeof(*icode), GFP_KERNEL); 2497 - if (icode == NULL) 2498 - return -ENOMEM; 2499 - if (copy_from_user(icode, argp, sizeof(*icode))) { 2500 - kfree(icode); 2501 - return -EFAULT; 2502 - } 2496 + 2497 + icode = memdup_user(argp, sizeof(*icode)); 2498 + if (IS_ERR(icode)) 2499 + return PTR_ERR(icode); 2503 2500 res = snd_emu10k1_icode_poke(emu, icode); 2504 2501 kfree(icode); 2505 2502 return res; 2506 2503 case SNDRV_EMU10K1_IOCTL_CODE_PEEK: 2507 - icode = kmalloc(sizeof(*icode), GFP_KERNEL); 2508 - if (icode == NULL) 2509 - return -ENOMEM; 2510 - if (copy_from_user(icode, argp, sizeof(*icode))) { 2511 - kfree(icode); 2512 - return -EFAULT; 2513 - } 2504 + icode = memdup_user(argp, sizeof(*icode)); 2505 + if (IS_ERR(icode)) 2506 + return PTR_ERR(icode); 2514 2507 res = snd_emu10k1_icode_peek(emu, icode); 2515 2508 if (res == 0 && copy_to_user(argp, icode, sizeof(*icode))) { 2516 2509 kfree(icode); ··· 2512 2519 kfree(icode); 2513 2520 return res; 2514 2521 case SNDRV_EMU10K1_IOCTL_PCM_POKE: 2515 - ipcm = kmalloc(sizeof(*ipcm), GFP_KERNEL); 2516 - if (ipcm == NULL) 2517 - return -ENOMEM; 2518 - if (copy_from_user(ipcm, argp, sizeof(*ipcm))) { 2519 - kfree(ipcm); 2520 - return -EFAULT; 2521 - } 2522 + ipcm = memdup_user(argp, sizeof(*ipcm)); 2523 + if (IS_ERR(ipcm)) 2524 + return PTR_ERR(ipcm); 2522 2525 res = snd_emu10k1_ipcm_poke(emu, ipcm); 2523 2526 kfree(ipcm); 2524 2527 return res; 2525 2528 case SNDRV_EMU10K1_IOCTL_PCM_PEEK: 2526 - ipcm = kzalloc(sizeof(*ipcm), GFP_KERNEL); 2527 - if (ipcm == NULL) 2528 - return -ENOMEM; 2529 - if (copy_from_user(ipcm, argp, sizeof(*ipcm))) { 2530 - kfree(ipcm); 2531 - return -EFAULT; 2532 - } 2529 + ipcm = memdup_user(argp, sizeof(*ipcm)); 2530 + if (IS_ERR(ipcm)) 2531 + return PTR_ERR(ipcm); 2533 2532 res = snd_emu10k1_ipcm_peek(emu, ipcm); 2534 2533 if (res == 0 && copy_to_user(argp, ipcm, sizeof(*ipcm))) { 2535 2534 kfree(ipcm);
+5 -1
sound/pci/hda/hda_codec.c
··· 2250 2250 err = bus->ops.command(bus, res); 2251 2251 if (!err) { 2252 2252 struct hda_cache_head *c; 2253 - u32 key = build_cmd_cache_key(nid, verb); 2253 + u32 key; 2254 + /* parm may contain the verb stuff for get/set amp */ 2255 + verb = verb | (parm >> 8); 2256 + parm &= 0xff; 2257 + key = build_cmd_cache_key(nid, verb); 2254 2258 c = get_alloc_hash(&codec->cmd_cache, key); 2255 2259 if (c) 2256 2260 c->val = parm;
+25 -14
sound/pci/hda/hda_intel.c
··· 312 312 unsigned int period_bytes; /* size of the period in bytes */ 313 313 unsigned int frags; /* number for period in the play buffer */ 314 314 unsigned int fifo_size; /* FIFO size */ 315 + unsigned int start_flag: 1; /* stream full start flag */ 316 + unsigned long start_jiffies; /* start + minimum jiffies */ 317 + unsigned long min_jiffies; /* minimum jiffies before position is valid */ 315 318 316 319 void __iomem *sd_addr; /* stream descriptor pointer */ 317 320 ··· 333 330 unsigned int opened :1; 334 331 unsigned int running :1; 335 332 unsigned int irq_pending :1; 336 - unsigned int irq_ignore :1; 337 333 /* 338 334 * For VIA: 339 335 * A flag to ensure DMA position is 0 ··· 977 975 struct azx *chip = dev_id; 978 976 struct azx_dev *azx_dev; 979 977 u32 status; 980 - int i; 978 + int i, ok; 981 979 982 980 spin_lock(&chip->reg_lock); 983 981 ··· 993 991 azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); 994 992 if (!azx_dev->substream || !azx_dev->running) 995 993 continue; 996 - /* ignore the first dummy IRQ (due to pos_adj) */ 997 - if (azx_dev->irq_ignore) { 998 - azx_dev->irq_ignore = 0; 999 - continue; 1000 - } 1001 994 /* check whether this IRQ is really acceptable */ 1002 - if (azx_position_ok(chip, azx_dev)) { 995 + ok = azx_position_ok(chip, azx_dev); 996 + if (ok == 1) { 1003 997 azx_dev->irq_pending = 0; 1004 998 spin_unlock(&chip->reg_lock); 1005 999 snd_pcm_period_elapsed(azx_dev->substream); 1006 1000 spin_lock(&chip->reg_lock); 1007 - } else if (chip->bus && chip->bus->workq) { 1001 + } else if (ok == 0 && chip->bus && chip->bus->workq) { 1008 1002 /* bogus IRQ, process it later */ 1009 1003 azx_dev->irq_pending = 1; 1010 1004 queue_work(chip->bus->workq, ··· 1086 1088 bdl = (u32 *)azx_dev->bdl.area; 1087 1089 ofs = 0; 1088 1090 azx_dev->frags = 0; 1089 - azx_dev->irq_ignore = 0; 1090 1091 pos_adj = bdl_pos_adj[chip->dev_index]; 1091 1092 if (pos_adj > 0) { 1092 1093 struct snd_pcm_runtime *runtime = substream->runtime; ··· 1106 1109 &bdl, ofs, pos_adj, 1); 1107 1110 if (ofs < 0) 1108 1111 goto error; 1109 - azx_dev->irq_ignore = 1; 1110 1112 } 1111 1113 } else 1112 1114 pos_adj = 0; ··· 1151 1155 while (((val = azx_sd_readb(azx_dev, SD_CTL)) & SD_CTL_STREAM_RESET) && 1152 1156 --timeout) 1153 1157 ; 1158 + 1159 + /* reset first position - may not be synced with hw at this time */ 1160 + *azx_dev->posbuf = 0; 1154 1161 } 1155 1162 1156 1163 /* ··· 1408 1409 snd_pcm_set_sync(substream); 1409 1410 mutex_unlock(&chip->open_mutex); 1410 1411 1411 - azx_stream_reset(chip, azx_dev); 1412 1412 return 0; 1413 1413 } 1414 1414 ··· 1472 1474 unsigned int bufsize, period_bytes, format_val; 1473 1475 int err; 1474 1476 1477 + azx_stream_reset(chip, azx_dev); 1475 1478 format_val = snd_hda_calc_stream_format(runtime->rate, 1476 1479 runtime->channels, 1477 1480 runtime->format, ··· 1501 1502 return err; 1502 1503 } 1503 1504 1505 + azx_dev->min_jiffies = (runtime->period_size * HZ) / 1506 + (runtime->rate * 2); 1504 1507 azx_setup_controller(chip, azx_dev); 1505 1508 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 1506 1509 azx_dev->fifo_size = azx_sd_readw(azx_dev, SD_FIFOSIZE) + 1; ··· 1519 1518 struct azx *chip = apcm->chip; 1520 1519 struct azx_dev *azx_dev; 1521 1520 struct snd_pcm_substream *s; 1522 - int start, nsync = 0, sbits = 0; 1521 + int rstart = 0, start, nsync = 0, sbits = 0; 1523 1522 int nwait, timeout; 1524 1523 1525 1524 switch (cmd) { 1525 + case SNDRV_PCM_TRIGGER_START: 1526 + rstart = 1; 1526 1527 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 1527 1528 case SNDRV_PCM_TRIGGER_RESUME: 1528 - case SNDRV_PCM_TRIGGER_START: 1529 1529 start = 1; 1530 1530 break; 1531 1531 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: ··· 1556 1554 if (s->pcm->card != substream->pcm->card) 1557 1555 continue; 1558 1556 azx_dev = get_azx_dev(s); 1557 + if (rstart) { 1558 + azx_dev->start_flag = 1; 1559 + azx_dev->start_jiffies = jiffies + azx_dev->min_jiffies; 1560 + } 1559 1561 if (start) 1560 1562 azx_stream_start(chip, azx_dev); 1561 1563 else ··· 1708 1702 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) 1709 1703 { 1710 1704 unsigned int pos; 1705 + 1706 + if (azx_dev->start_flag && 1707 + time_before_eq(jiffies, azx_dev->start_jiffies)) 1708 + return -1; /* bogus (too early) interrupt */ 1709 + azx_dev->start_flag = 0; 1711 1710 1712 1711 pos = azx_get_position(chip, azx_dev); 1713 1712 if (chip->position_fix == POS_FIX_AUTO) {
+18 -3
sound/pci/hda/patch_conexant.c
··· 350 350 } 351 351 352 352 #ifdef CONFIG_SND_JACK 353 + static void conexant_free_jack_priv(struct snd_jack *jack) 354 + { 355 + struct conexant_jack *jacks = jack->private_data; 356 + jacks->nid = 0; 357 + jacks->jack = NULL; 358 + } 359 + 353 360 static int conexant_add_jack(struct hda_codec *codec, 354 361 hda_nid_t nid, int type) 355 362 { 356 363 struct conexant_spec *spec; 357 364 struct conexant_jack *jack; 358 365 const char *name; 366 + int err; 359 367 360 368 spec = codec->spec; 361 369 snd_array_init(&spec->jacks, sizeof(*jack), 32); ··· 376 368 jack->nid = nid; 377 369 jack->type = type; 378 370 379 - return snd_jack_new(codec->bus->card, name, type, &jack->jack); 371 + err = snd_jack_new(codec->bus->card, name, type, &jack->jack); 372 + if (err < 0) 373 + return err; 374 + jack->jack->private_data = jack; 375 + jack->jack->private_free = conexant_free_jack_priv; 376 + return 0; 380 377 } 381 378 382 379 static void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid) ··· 468 455 if (spec->jacks.list) { 469 456 struct conexant_jack *jacks = spec->jacks.list; 470 457 int i; 471 - for (i = 0; i < spec->jacks.used; i++) 472 - snd_device_free(codec->bus->card, &jacks[i].jack); 458 + for (i = 0; i < spec->jacks.used; i++, jacks++) { 459 + if (jacks->jack) 460 + snd_device_free(codec->bus->card, jacks->jack); 461 + } 473 462 snd_array_free(&spec->jacks); 474 463 } 475 464 #endif
+2 -3
sound/pci/hda/patch_realtek.c
··· 8742 8742 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), 8743 8743 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), 8744 8744 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), 8745 - SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550", 8745 + SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", 8746 8746 ALC883_FUJITSU_PI2515), 8747 - SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), 8748 - SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530", 8747 + SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", 8749 8748 ALC888_FUJITSU_XA3530), 8750 8749 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), 8751 8750 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
+22 -5
sound/pci/hda/patch_sigmatel.c
··· 3851 3851 AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */ 3852 3852 } 3853 3853 3854 + #ifdef CONFIG_SND_JACK 3855 + static void stac92xx_free_jack_priv(struct snd_jack *jack) 3856 + { 3857 + struct sigmatel_jack *jacks = jack->private_data; 3858 + jacks->nid = 0; 3859 + jacks->jack = NULL; 3860 + } 3861 + #endif 3862 + 3854 3863 static int stac92xx_add_jack(struct hda_codec *codec, 3855 3864 hda_nid_t nid, int type) 3856 3865 { ··· 3869 3860 int def_conf = snd_hda_codec_get_pincfg(codec, nid); 3870 3861 int connectivity = get_defcfg_connect(def_conf); 3871 3862 char name[32]; 3863 + int err; 3872 3864 3873 3865 if (connectivity && connectivity != AC_JACK_PORT_FIXED) 3874 3866 return 0; ··· 3886 3876 snd_hda_get_jack_connectivity(def_conf), 3887 3877 snd_hda_get_jack_location(def_conf)); 3888 3878 3889 - return snd_jack_new(codec->bus->card, name, type, &jack->jack); 3890 - #else 3891 - return 0; 3879 + err = snd_jack_new(codec->bus->card, name, type, &jack->jack); 3880 + if (err < 0) { 3881 + jack->nid = 0; 3882 + return err; 3883 + } 3884 + jack->jack->private_data = jack; 3885 + jack->jack->private_free = stac92xx_free_jack_priv; 3892 3886 #endif 3887 + return 0; 3893 3888 } 3894 3889 3895 3890 static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid, ··· 4153 4138 if (!codec->bus->shutdown && spec->jacks.list) { 4154 4139 struct sigmatel_jack *jacks = spec->jacks.list; 4155 4140 int i; 4156 - for (i = 0; i < spec->jacks.used; i++) 4157 - snd_device_free(codec->bus->card, &jacks[i].jack); 4141 + for (i = 0; i < spec->jacks.used; i++, jacks++) { 4142 + if (jacks->jack) 4143 + snd_device_free(codec->bus->card, jacks->jack); 4144 + } 4158 4145 } 4159 4146 snd_array_free(&spec->jacks); 4160 4147 #endif
+72 -23
sound/pci/intel8x0.c
··· 355 355 unsigned int fragsize1; 356 356 unsigned int position; 357 357 unsigned int pos_shift; 358 + unsigned int last_pos; 359 + unsigned long last_pos_jiffies; 360 + unsigned int jiffy_to_bytes; 358 361 int frags; 359 362 int lvi; 360 363 int lvi_frag; ··· 841 838 ichdev->suspended = 0; 842 839 /* fallthru */ 843 840 case SNDRV_PCM_TRIGGER_START: 841 + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 844 842 val = ICH_IOCE | ICH_STARTBM; 843 + ichdev->last_pos = ichdev->position; 844 + ichdev->last_pos_jiffies = jiffies; 845 845 break; 846 846 case SNDRV_PCM_TRIGGER_SUSPEND: 847 847 ichdev->suspended = 1; ··· 854 848 break; 855 849 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 856 850 val = ICH_IOCE; 857 - break; 858 - case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 859 - val = ICH_IOCE | ICH_STARTBM; 860 851 break; 861 852 default: 862 853 return -EINVAL; ··· 1048 1045 ichdev->pos_shift = (runtime->sample_bits > 16) ? 2 : 1; 1049 1046 } 1050 1047 snd_intel8x0_setup_periods(chip, ichdev); 1048 + ichdev->jiffy_to_bytes = (runtime->rate * 4 * ichdev->pos_shift) / HZ; 1051 1049 return 0; 1052 1050 } 1053 1051 ··· 1057 1053 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1058 1054 struct ichdev *ichdev = get_ichdev(substream); 1059 1055 size_t ptr1, ptr; 1060 - int civ, timeout = 100; 1056 + int civ, timeout = 10; 1061 1057 unsigned int position; 1062 1058 1063 1059 spin_lock(&chip->reg_lock); ··· 1073 1069 ptr1 == igetword(chip, ichdev->reg_offset + ichdev->roff_picb)) 1074 1070 break; 1075 1071 } while (timeout--); 1076 - ptr1 <<= ichdev->pos_shift; 1077 - ptr = ichdev->fragsize1 - ptr1; 1078 - ptr += position; 1072 + if (ptr1 != 0) { 1073 + ptr1 <<= ichdev->pos_shift; 1074 + ptr = ichdev->fragsize1 - ptr1; 1075 + ptr += position; 1076 + ichdev->last_pos = ptr; 1077 + ichdev->last_pos_jiffies = jiffies; 1078 + } else { 1079 + ptr1 = jiffies - ichdev->last_pos_jiffies; 1080 + if (ptr1) 1081 + ptr1 -= 1; 1082 + ptr = ichdev->last_pos + ptr1 * ichdev->jiffy_to_bytes; 1083 + ptr %= ichdev->size; 1084 + } 1079 1085 spin_unlock(&chip->reg_lock); 1080 1086 if (ptr >= ichdev->size) 1081 1087 return 0; ··· 2675 2661 struct snd_pcm_substream *subs; 2676 2662 struct ichdev *ichdev; 2677 2663 unsigned long port; 2678 - unsigned long pos, t; 2679 - struct timeval start_time, stop_time; 2664 + unsigned long pos, pos1, t; 2665 + int civ, timeout = 1000, attempt = 1; 2666 + struct timespec start_time, stop_time; 2680 2667 2681 2668 if (chip->ac97_bus->clock != 48000) 2682 2669 return; /* specified in module option */ 2683 2670 2671 + __again: 2684 2672 subs = chip->pcm[0]->streams[0].substream; 2685 2673 if (! subs || subs->dma_buffer.bytes < INTEL8X0_TESTBUF_SIZE) { 2686 2674 snd_printk(KERN_WARNING "no playback buffer allocated - aborting measure ac97 clock\n"); ··· 2690 2674 } 2691 2675 ichdev = &chip->ichd[ICHD_PCMOUT]; 2692 2676 ichdev->physbuf = subs->dma_buffer.addr; 2693 - ichdev->size = chip->ichd[ICHD_PCMOUT].fragsize = INTEL8X0_TESTBUF_SIZE; 2677 + ichdev->size = ichdev->fragsize = INTEL8X0_TESTBUF_SIZE; 2694 2678 ichdev->substream = NULL; /* don't process interrupts */ 2695 2679 2696 2680 /* set rate */ ··· 2709 2693 iputbyte(chip, port + ICH_REG_OFF_CR, ICH_IOCE); 2710 2694 iputdword(chip, ICHREG(ALI_DMACR), 1 << ichdev->ali_slot); 2711 2695 } 2712 - do_gettimeofday(&start_time); 2696 + do_posix_clock_monotonic_gettime(&start_time); 2713 2697 spin_unlock_irq(&chip->reg_lock); 2714 2698 msleep(50); 2715 2699 spin_lock_irq(&chip->reg_lock); 2716 2700 /* check the position */ 2717 - pos = ichdev->fragsize1; 2718 - pos -= igetword(chip, ichdev->reg_offset + ichdev->roff_picb) << ichdev->pos_shift; 2719 - pos += ichdev->position; 2701 + do { 2702 + civ = igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV); 2703 + pos1 = igetword(chip, ichdev->reg_offset + ichdev->roff_picb); 2704 + if (pos1 == 0) { 2705 + udelay(10); 2706 + continue; 2707 + } 2708 + if (civ == igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV) && 2709 + pos1 == igetword(chip, ichdev->reg_offset + ichdev->roff_picb)) 2710 + break; 2711 + } while (timeout--); 2712 + if (pos1 == 0) { /* oops, this value is not reliable */ 2713 + pos = 0; 2714 + } else { 2715 + pos = ichdev->fragsize1; 2716 + pos -= pos1 << ichdev->pos_shift; 2717 + pos += ichdev->position; 2718 + } 2720 2719 chip->in_measurement = 0; 2721 - do_gettimeofday(&stop_time); 2720 + do_posix_clock_monotonic_gettime(&stop_time); 2722 2721 /* stop */ 2723 2722 if (chip->device_type == DEVICE_ALI) { 2724 2723 iputdword(chip, ICHREG(ALI_DMACR), 1 << (ichdev->ali_slot + 16)); ··· 2748 2717 iputbyte(chip, port + ICH_REG_OFF_CR, ICH_RESETREGS); 2749 2718 spin_unlock_irq(&chip->reg_lock); 2750 2719 2751 - t = stop_time.tv_sec - start_time.tv_sec; 2752 - t *= 1000000; 2753 - t += stop_time.tv_usec - start_time.tv_usec; 2754 - printk(KERN_INFO "%s: measured %lu usecs\n", __func__, t); 2755 - if (t == 0) { 2756 - snd_printk(KERN_ERR "?? calculation error..\n"); 2720 + if (pos == 0) { 2721 + snd_printk(KERN_ERR "intel8x0: measure - unreliable DMA position..\n"); 2722 + __retry: 2723 + if (attempt < 2) { 2724 + attempt++; 2725 + goto __again; 2726 + } 2757 2727 return; 2758 2728 } 2759 - pos = (pos / 4) * 1000; 2729 + 2730 + pos /= 4; 2731 + t = stop_time.tv_sec - start_time.tv_sec; 2732 + t *= 1000000; 2733 + t += (stop_time.tv_nsec - start_time.tv_nsec) / 1000; 2734 + printk(KERN_INFO "%s: measured %lu usecs (%lu samples)\n", __func__, t, pos); 2735 + if (t == 0) { 2736 + snd_printk(KERN_ERR "intel8x0: ?? calculation error..\n"); 2737 + goto __retry; 2738 + } 2739 + pos *= 1000; 2760 2740 pos = (pos / t) * 1000 + ((pos % t) * 1000) / t; 2761 - if (pos < 40000 || pos >= 60000) 2741 + if (pos < 40000 || pos >= 60000) { 2762 2742 /* abnormal value. hw problem? */ 2763 2743 printk(KERN_INFO "intel8x0: measured clock %ld rejected\n", pos); 2744 + goto __retry; 2745 + } else if (pos > 40500 && pos < 41500) 2746 + /* first exception - 41000Hz reference clock */ 2747 + chip->ac97_bus->clock = 41000; 2748 + else if (pos > 43600 && pos < 44600) 2749 + /* second exception - 44100HZ reference clock */ 2750 + chip->ac97_bus->clock = 44100; 2764 2751 else if (pos < 47500 || pos > 48500) 2765 2752 /* not 48000Hz, tuning the clock.. */ 2766 2753 chip->ac97_bus->clock = (chip->ac97_bus->clock * 48000) / pos;
-2
sound/soc/pxa/magician.c
··· 27 27 #include <sound/soc.h> 28 28 #include <sound/soc-dapm.h> 29 29 30 - #include <mach/pxa-regs.h> 31 - #include <mach/hardware.h> 32 30 #include <mach/magician.h> 33 31 #include <asm/mach-types.h> 34 32 #include "../codecs/uda1380.h"
+3 -3
sound/soc/s3c24xx/Kconfig
··· 1 1 config SND_S3C24XX_SOC 2 2 tristate "SoC Audio for the Samsung S3CXXXX chips" 3 - depends on ARCH_S3C2410 || ARCH_S3C64XX 3 + depends on ARCH_S3C2410 4 4 help 5 5 Say Y or M if you want to add support for codecs attached to 6 - the S3C24XX and S3C64XX AC97, I2S or SSP interface. You will 7 - also need to select the audio interfaces to support below. 6 + the S3C24XX AC97 or I2S interfaces. You will also need to 7 + select the audio interfaces to support below. 8 8 9 9 config SND_S3C24XX_SOC_I2S 10 10 tristate
+2 -2
sound/usb/caiaq/Makefile
··· 1 - snd-usb-caiaq-y := caiaq-device.o caiaq-audio.o caiaq-midi.o caiaq-control.o 2 - snd-usb-caiaq-$(CONFIG_SND_USB_CAIAQ_INPUT) += caiaq-input.o 1 + snd-usb-caiaq-y := device.o audio.o midi.o control.o 2 + snd-usb-caiaq-$(CONFIG_SND_USB_CAIAQ_INPUT) += input.o 3 3 4 4 obj-$(CONFIG_SND_USB_CAIAQ) += snd-usb-caiaq.o
+4 -10
sound/usb/caiaq/caiaq-audio.c sound/usb/caiaq/audio.c
··· 16 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 17 */ 18 18 19 - #include <linux/init.h> 20 - #include <linux/module.h> 21 - #include <linux/moduleparam.h> 22 - #include <linux/interrupt.h> 23 - #include <linux/usb.h> 24 19 #include <linux/spinlock.h> 20 + #include <linux/init.h> 21 + #include <linux/usb.h> 25 22 #include <sound/core.h> 26 - #include <sound/initval.h> 27 23 #include <sound/pcm.h> 28 - #include <sound/rawmidi.h> 29 - #include <linux/input.h> 30 24 31 - #include "caiaq-device.h" 32 - #include "caiaq-audio.h" 25 + #include "device.h" 26 + #include "audio.h" 33 27 34 28 #define N_URBS 32 35 29 #define CLOCK_DRIFT_TOLERANCE 5
sound/usb/caiaq/caiaq-audio.h sound/usb/caiaq/audio.h
+4 -8
sound/usb/caiaq/caiaq-control.c sound/usb/caiaq/control.c
··· 18 18 */ 19 19 20 20 #include <linux/init.h> 21 - #include <linux/interrupt.h> 22 21 #include <linux/usb.h> 23 - #include <sound/core.h> 24 - #include <sound/initval.h> 25 - #include <sound/pcm.h> 26 - #include <sound/rawmidi.h> 27 22 #include <sound/control.h> 28 - #include <linux/input.h> 23 + #include <sound/core.h> 24 + #include <sound/pcm.h> 29 25 30 - #include "caiaq-device.h" 31 - #include "caiaq-control.h" 26 + #include "device.h" 27 + #include "control.h" 32 28 33 29 #define CNT_INTVAL 0x10000 34 30
sound/usb/caiaq/caiaq-control.h sound/usb/caiaq/control.h
+8 -15
sound/usb/caiaq/caiaq-device.c sound/usb/caiaq/device.c
··· 19 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 20 */ 21 21 22 - #include <linux/init.h> 23 - #include <linux/module.h> 24 22 #include <linux/moduleparam.h> 25 23 #include <linux/interrupt.h> 24 + #include <linux/module.h> 25 + #include <linux/init.h> 26 26 #include <linux/usb.h> 27 - #include <linux/input.h> 28 - #include <linux/spinlock.h> 29 - #include <sound/core.h> 30 27 #include <sound/initval.h> 28 + #include <sound/core.h> 31 29 #include <sound/pcm.h> 32 - #include <sound/rawmidi.h> 33 - #include <sound/control.h> 34 30 35 - #include "caiaq-device.h" 36 - #include "caiaq-audio.h" 37 - #include "caiaq-midi.h" 38 - #include "caiaq-control.h" 39 - 40 - #ifdef CONFIG_SND_USB_CAIAQ_INPUT 41 - #include "caiaq-input.h" 42 - #endif 31 + #include "device.h" 32 + #include "audio.h" 33 + #include "midi.h" 34 + #include "control.h" 35 + #include "input.h" 43 36 44 37 MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); 45 38 MODULE_DESCRIPTION("caiaq USB audio, version 1.3.13");
sound/usb/caiaq/caiaq-device.h sound/usb/caiaq/device.h
+3 -8
sound/usb/caiaq/caiaq-input.c sound/usb/caiaq/input.c
··· 17 17 */ 18 18 19 19 #include <linux/init.h> 20 - #include <linux/module.h> 21 - #include <linux/moduleparam.h> 22 - #include <linux/input.h> 23 20 #include <linux/usb.h> 24 21 #include <linux/usb/input.h> 25 - #include <linux/spinlock.h> 26 - #include <sound/core.h> 27 - #include <sound/rawmidi.h> 28 22 #include <sound/pcm.h> 29 - #include "caiaq-device.h" 30 - #include "caiaq-input.h" 23 + 24 + #include "device.h" 25 + #include "input.h" 31 26 32 27 static unsigned short keycode_ak1[] = { KEY_C, KEY_B, KEY_A }; 33 28 static unsigned short keycode_rk2[] = { KEY_1, KEY_2, KEY_3, KEY_4,
sound/usb/caiaq/caiaq-input.h sound/usb/caiaq/input.h
+3 -10
sound/usb/caiaq/caiaq-midi.c sound/usb/caiaq/midi.c
··· 16 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 17 */ 18 18 19 - #include <linux/init.h> 20 - #include <linux/module.h> 21 - #include <linux/moduleparam.h> 22 - #include <linux/interrupt.h> 23 19 #include <linux/usb.h> 24 - #include <linux/input.h> 25 - #include <linux/spinlock.h> 26 - #include <sound/core.h> 27 20 #include <sound/rawmidi.h> 21 + #include <sound/core.h> 28 22 #include <sound/pcm.h> 29 23 30 - #include "caiaq-device.h" 31 - #include "caiaq-midi.h" 32 - 24 + #include "device.h" 25 + #include "midi.h" 33 26 34 27 static int snd_usb_caiaq_midi_input_open(struct snd_rawmidi_substream *substream) 35 28 {
sound/usb/caiaq/caiaq-midi.h sound/usb/caiaq/midi.h
+3 -7
sound/usb/usx2y/us122l.c
··· 349 349 if (cmd != SNDRV_USB_STREAM_IOCTL_SET_PARAMS) 350 350 return -ENOTTY; 351 351 352 - cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); 353 - if (!cfg) 354 - return -ENOMEM; 352 + cfg = memdup_user((void *)arg, sizeof(*cfg)); 353 + if (IS_ERR(cfg)) 354 + return PTR_ERR(cfg); 355 355 356 - if (copy_from_user(cfg, (void *)arg, sizeof(*cfg))) { 357 - err = -EFAULT; 358 - goto free; 359 - } 360 356 if (cfg->version != USB_STREAM_INTERFACE_VERSION) { 361 357 err = -ENXIO; 362 358 goto free;
+6 -7
sound/usb/usx2y/usX2Yhwdep.c
··· 203 203 204 204 if (access_ok(VERIFY_READ, dsp->image, dsp->length)) { 205 205 struct usb_device* dev = priv->chip.dev; 206 - char *buf = kmalloc(dsp->length, GFP_KERNEL); 207 - if (!buf) 208 - return -ENOMEM; 209 - if (copy_from_user(buf, dsp->image, dsp->length)) { 210 - kfree(buf); 211 - return -EFAULT; 212 - } 206 + char *buf; 207 + 208 + buf = memdup_user(dsp->image, dsp->length); 209 + if (IS_ERR(buf)) 210 + return PTR_ERR(buf); 211 + 213 212 err = usb_set_interface(dev, 0, 1); 214 213 if (err) 215 214 snd_printk(KERN_ERR "usb_set_interface error \n");