forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/media/pci/solo6x10/solo6x10-g723.c
....@@ -1,21 +1,12 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
2
- * Copyright (C) 2010-2013 Bluecherry, LLC <http://www.bluecherrydvr.com>
3
+ * Copyright (C) 2010-2013 Bluecherry, LLC <https://www.bluecherrydvr.com>
34 *
45 * Original author:
56 * Ben Collins <bcollins@ubuntu.com>
67 *
78 * Additional work by:
89 * John Brooks <john.brooks@bluecherry.net>
9
- *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License as published by
12
- * the Free Software Foundation; either version 2 of the License, or
13
- * (at your option) any later version.
14
- *
15
- * This program is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
- * GNU General Public License for more details.
1910 */
2011
2112 #include <linux/kernel.h>
....@@ -104,17 +95,6 @@
10495
10596 snd_pcm_period_elapsed(ss);
10697 }
107
-}
108
-
109
-static int snd_solo_hw_params(struct snd_pcm_substream *ss,
110
- struct snd_pcm_hw_params *hw_params)
111
-{
112
- return snd_pcm_lib_malloc_pages(ss, params_buffer_bytes(hw_params));
113
-}
114
-
115
-static int snd_solo_hw_free(struct snd_pcm_substream *ss)
116
-{
117
- return snd_pcm_lib_free_pages(ss);
11898 }
11999
120100 static const struct snd_pcm_hardware snd_solo_pcm_hw = {
....@@ -279,9 +259,6 @@
279259 static const struct snd_pcm_ops snd_solo_pcm_ops = {
280260 .open = snd_solo_pcm_open,
281261 .close = snd_solo_pcm_close,
282
- .ioctl = snd_pcm_lib_ioctl,
283
- .hw_params = snd_solo_hw_params,
284
- .hw_free = snd_solo_hw_free,
285262 .prepare = snd_solo_pcm_prepare,
286263 .trigger = snd_solo_pcm_trigger,
287264 .pointer = snd_solo_pcm_pointer,
....@@ -354,19 +331,17 @@
354331
355332 snd_pcm_chip(pcm) = solo_dev;
356333 pcm->info_flags = 0;
357
- strcpy(pcm->name, card->shortname);
334
+ strscpy(pcm->name, card->shortname, sizeof(pcm->name));
358335
359336 for (i = 0, ss = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
360337 ss; ss = ss->next, i++)
361338 sprintf(ss->name, "Camera #%d Audio", i);
362339
363
- ret = snd_pcm_lib_preallocate_pages_for_all(pcm,
364
- SNDRV_DMA_TYPE_CONTINUOUS,
365
- snd_dma_continuous_data(GFP_KERNEL),
366
- G723_PERIOD_BYTES * PERIODS,
367
- G723_PERIOD_BYTES * PERIODS);
368
- if (ret < 0)
369
- return ret;
340
+ snd_pcm_set_managed_buffer_all(pcm,
341
+ SNDRV_DMA_TYPE_CONTINUOUS,
342
+ NULL,
343
+ G723_PERIOD_BYTES * PERIODS,
344
+ G723_PERIOD_BYTES * PERIODS);
370345
371346 solo_dev->snd_pcm = pcm;
372347
....@@ -394,8 +369,8 @@
394369
395370 card = solo_dev->snd_card;
396371
397
- strcpy(card->driver, SOLO6X10_NAME);
398
- strcpy(card->shortname, "SOLO-6x10 Audio");
372
+ strscpy(card->driver, SOLO6X10_NAME, sizeof(card->driver));
373
+ strscpy(card->shortname, "SOLO-6x10 Audio", sizeof(card->shortname));
399374 sprintf(card->longname, "%s on %s IRQ %d", card->shortname,
400375 pci_name(solo_dev->pdev), solo_dev->pdev->irq);
401376
....@@ -404,7 +379,7 @@
404379 goto snd_error;
405380
406381 /* Mixer controls */
407
- strcpy(card->mixername, "SOLO-6x10");
382
+ strscpy(card->mixername, "SOLO-6x10", sizeof(card->mixername));
408383 kctl = snd_solo_capture_volume;
409384 kctl.count = solo_dev->nr_chans;
410385