| .. | .. |
|---|
| 85 | 85 | return 0; |
|---|
| 86 | 86 | } |
|---|
| 87 | 87 | |
|---|
| 88 | | -static int snd_usbtv_hw_params(struct snd_pcm_substream *substream, |
|---|
| 89 | | - struct snd_pcm_hw_params *hw_params) |
|---|
| 90 | | -{ |
|---|
| 91 | | - int rv; |
|---|
| 92 | | - struct usbtv *chip = snd_pcm_substream_chip(substream); |
|---|
| 93 | | - |
|---|
| 94 | | - rv = snd_pcm_lib_malloc_pages(substream, |
|---|
| 95 | | - params_buffer_bytes(hw_params)); |
|---|
| 96 | | - |
|---|
| 97 | | - if (rv < 0) { |
|---|
| 98 | | - dev_warn(chip->dev, "pcm audio buffer allocation failure %i\n", |
|---|
| 99 | | - rv); |
|---|
| 100 | | - return rv; |
|---|
| 101 | | - } |
|---|
| 102 | | - |
|---|
| 103 | | - return 0; |
|---|
| 104 | | -} |
|---|
| 105 | | - |
|---|
| 106 | | -static int snd_usbtv_hw_free(struct snd_pcm_substream *substream) |
|---|
| 107 | | -{ |
|---|
| 108 | | - snd_pcm_lib_free_pages(substream); |
|---|
| 109 | | - return 0; |
|---|
| 110 | | -} |
|---|
| 111 | | - |
|---|
| 112 | 88 | static int snd_usbtv_prepare(struct snd_pcm_substream *substream) |
|---|
| 113 | 89 | { |
|---|
| 114 | 90 | struct usbtv *chip = snd_pcm_substream_chip(substream); |
|---|
| .. | .. |
|---|
| 336 | 312 | static const struct snd_pcm_ops snd_usbtv_pcm_ops = { |
|---|
| 337 | 313 | .open = snd_usbtv_pcm_open, |
|---|
| 338 | 314 | .close = snd_usbtv_pcm_close, |
|---|
| 339 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 340 | | - .hw_params = snd_usbtv_hw_params, |
|---|
| 341 | | - .hw_free = snd_usbtv_hw_free, |
|---|
| 342 | 315 | .prepare = snd_usbtv_prepare, |
|---|
| 343 | 316 | .trigger = snd_usbtv_card_trigger, |
|---|
| 344 | 317 | .pointer = snd_usbtv_pointer, |
|---|
| .. | .. |
|---|
| 358 | 331 | if (rv < 0) |
|---|
| 359 | 332 | return rv; |
|---|
| 360 | 333 | |
|---|
| 361 | | - strlcpy(card->driver, usbtv->dev->driver->name, sizeof(card->driver)); |
|---|
| 362 | | - strlcpy(card->shortname, "usbtv", sizeof(card->shortname)); |
|---|
| 334 | + strscpy(card->driver, usbtv->dev->driver->name, sizeof(card->driver)); |
|---|
| 335 | + strscpy(card->shortname, "usbtv", sizeof(card->shortname)); |
|---|
| 363 | 336 | snprintf(card->longname, sizeof(card->longname), |
|---|
| 364 | 337 | "USBTV Audio at bus %d device %d", usbtv->udev->bus->busnum, |
|---|
| 365 | 338 | usbtv->udev->devnum); |
|---|
| .. | .. |
|---|
| 372 | 345 | if (rv < 0) |
|---|
| 373 | 346 | goto err; |
|---|
| 374 | 347 | |
|---|
| 375 | | - strlcpy(pcm->name, "USBTV Audio Input", sizeof(pcm->name)); |
|---|
| 348 | + strscpy(pcm->name, "USBTV Audio Input", sizeof(pcm->name)); |
|---|
| 376 | 349 | pcm->info_flags = 0; |
|---|
| 377 | 350 | pcm->private_data = usbtv; |
|---|
| 378 | 351 | |
|---|
| 379 | 352 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_usbtv_pcm_ops); |
|---|
| 380 | | - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, |
|---|
| 381 | | - snd_dma_continuous_data(GFP_KERNEL), USBTV_AUDIO_BUFFER, |
|---|
| 382 | | - USBTV_AUDIO_BUFFER); |
|---|
| 353 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, |
|---|
| 354 | + NULL, USBTV_AUDIO_BUFFER, USBTV_AUDIO_BUFFER); |
|---|
| 383 | 355 | |
|---|
| 384 | 356 | rv = snd_card_register(card); |
|---|
| 385 | 357 | if (rv) |
|---|