hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/media/usb/usbtv/usbtv-audio.c
....@@ -85,30 +85,6 @@
8585 return 0;
8686 }
8787
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
-
11288 static int snd_usbtv_prepare(struct snd_pcm_substream *substream)
11389 {
11490 struct usbtv *chip = snd_pcm_substream_chip(substream);
....@@ -336,9 +312,6 @@
336312 static const struct snd_pcm_ops snd_usbtv_pcm_ops = {
337313 .open = snd_usbtv_pcm_open,
338314 .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,
342315 .prepare = snd_usbtv_prepare,
343316 .trigger = snd_usbtv_card_trigger,
344317 .pointer = snd_usbtv_pointer,
....@@ -358,8 +331,8 @@
358331 if (rv < 0)
359332 return rv;
360333
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));
363336 snprintf(card->longname, sizeof(card->longname),
364337 "USBTV Audio at bus %d device %d", usbtv->udev->bus->busnum,
365338 usbtv->udev->devnum);
....@@ -372,14 +345,13 @@
372345 if (rv < 0)
373346 goto err;
374347
375
- strlcpy(pcm->name, "USBTV Audio Input", sizeof(pcm->name));
348
+ strscpy(pcm->name, "USBTV Audio Input", sizeof(pcm->name));
376349 pcm->info_flags = 0;
377350 pcm->private_data = usbtv;
378351
379352 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);
383355
384356 rv = snd_card_register(card);
385357 if (rv)