| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | | - * Copyright (C) 2010-2013 Bluecherry, LLC <http://www.bluecherrydvr.com> |
|---|
| 3 | + * Copyright (C) 2010-2013 Bluecherry, LLC <https://www.bluecherrydvr.com> |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Original author: |
|---|
| 5 | 6 | * Ben Collins <bcollins@ubuntu.com> |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * Additional work by: |
|---|
| 8 | 9 | * 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. |
|---|
| 19 | 10 | */ |
|---|
| 20 | 11 | |
|---|
| 21 | 12 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 104 | 95 | |
|---|
| 105 | 96 | snd_pcm_period_elapsed(ss); |
|---|
| 106 | 97 | } |
|---|
| 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); |
|---|
| 118 | 98 | } |
|---|
| 119 | 99 | |
|---|
| 120 | 100 | static const struct snd_pcm_hardware snd_solo_pcm_hw = { |
|---|
| .. | .. |
|---|
| 279 | 259 | static const struct snd_pcm_ops snd_solo_pcm_ops = { |
|---|
| 280 | 260 | .open = snd_solo_pcm_open, |
|---|
| 281 | 261 | .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, |
|---|
| 285 | 262 | .prepare = snd_solo_pcm_prepare, |
|---|
| 286 | 263 | .trigger = snd_solo_pcm_trigger, |
|---|
| 287 | 264 | .pointer = snd_solo_pcm_pointer, |
|---|
| .. | .. |
|---|
| 354 | 331 | |
|---|
| 355 | 332 | snd_pcm_chip(pcm) = solo_dev; |
|---|
| 356 | 333 | pcm->info_flags = 0; |
|---|
| 357 | | - strcpy(pcm->name, card->shortname); |
|---|
| 334 | + strscpy(pcm->name, card->shortname, sizeof(pcm->name)); |
|---|
| 358 | 335 | |
|---|
| 359 | 336 | for (i = 0, ss = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; |
|---|
| 360 | 337 | ss; ss = ss->next, i++) |
|---|
| 361 | 338 | sprintf(ss->name, "Camera #%d Audio", i); |
|---|
| 362 | 339 | |
|---|
| 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); |
|---|
| 370 | 345 | |
|---|
| 371 | 346 | solo_dev->snd_pcm = pcm; |
|---|
| 372 | 347 | |
|---|
| .. | .. |
|---|
| 394 | 369 | |
|---|
| 395 | 370 | card = solo_dev->snd_card; |
|---|
| 396 | 371 | |
|---|
| 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)); |
|---|
| 399 | 374 | sprintf(card->longname, "%s on %s IRQ %d", card->shortname, |
|---|
| 400 | 375 | pci_name(solo_dev->pdev), solo_dev->pdev->irq); |
|---|
| 401 | 376 | |
|---|
| .. | .. |
|---|
| 404 | 379 | goto snd_error; |
|---|
| 405 | 380 | |
|---|
| 406 | 381 | /* Mixer controls */ |
|---|
| 407 | | - strcpy(card->mixername, "SOLO-6x10"); |
|---|
| 382 | + strscpy(card->mixername, "SOLO-6x10", sizeof(card->mixername)); |
|---|
| 408 | 383 | kctl = snd_solo_capture_volume; |
|---|
| 409 | 384 | kctl.count = solo_dev->nr_chans; |
|---|
| 410 | 385 | |
|---|