| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Support for audio capture |
|---|
| 3 | 4 | * PCI function #1 of the cx2388x. |
|---|
| .. | .. |
|---|
| 7 | 8 | * (c) 2005 Mauro Carvalho Chehab <mchehab@kernel.org> |
|---|
| 8 | 9 | * Based on a dummy cx88 module by Gerd Knorr <kraxel@bytesex.org> |
|---|
| 9 | 10 | * Based on dummy.c by Jaroslav Kysela <perex@perex.cz> |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 12 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 13 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 14 | | - * (at your option) any later version. |
|---|
| 15 | | - * |
|---|
| 16 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 17 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 18 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 19 | | - * GNU General Public License for more details. |
|---|
| 20 | 11 | */ |
|---|
| 21 | 12 | |
|---|
| 22 | 13 | #include "cx88.h" |
|---|
| .. | .. |
|---|
| 51 | 42 | */ |
|---|
| 52 | 43 | |
|---|
| 53 | 44 | struct cx88_audio_buffer { |
|---|
| 54 | | - unsigned int bpl; |
|---|
| 55 | | - struct cx88_riscmem risc; |
|---|
| 45 | + unsigned int bpl; |
|---|
| 46 | + struct cx88_riscmem risc; |
|---|
| 56 | 47 | void *vaddr; |
|---|
| 57 | 48 | struct scatterlist *sglist; |
|---|
| 58 | 49 | int sglen; |
|---|
| 59 | | - int nr_pages; |
|---|
| 50 | + unsigned long nr_pages; |
|---|
| 60 | 51 | }; |
|---|
| 61 | 52 | |
|---|
| 62 | 53 | struct cx88_audio_dev { |
|---|
| .. | .. |
|---|
| 104 | 95 | MODULE_DESCRIPTION("ALSA driver module for cx2388x based TV cards"); |
|---|
| 105 | 96 | MODULE_AUTHOR("Ricardo Cerqueira"); |
|---|
| 106 | 97 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@kernel.org>"); |
|---|
| 107 | | -MODULE_LICENSE("GPL"); |
|---|
| 98 | +MODULE_LICENSE("GPL v2"); |
|---|
| 108 | 99 | MODULE_VERSION(CX88_VERSION); |
|---|
| 109 | 100 | |
|---|
| 110 | 101 | MODULE_SUPPORTED_DEVICE("{{Conexant,23881},{{Conexant,23882},{{Conexant,23883}"); |
|---|
| .. | .. |
|---|
| 280 | 271 | return IRQ_RETVAL(handled); |
|---|
| 281 | 272 | } |
|---|
| 282 | 273 | |
|---|
| 283 | | -static int cx88_alsa_dma_init(struct cx88_audio_dev *chip, int nr_pages) |
|---|
| 274 | +static int cx88_alsa_dma_init(struct cx88_audio_dev *chip, |
|---|
| 275 | + unsigned long nr_pages) |
|---|
| 284 | 276 | { |
|---|
| 285 | 277 | struct cx88_audio_buffer *buf = chip->buf; |
|---|
| 286 | 278 | struct page *pg; |
|---|
| .. | .. |
|---|
| 288 | 280 | |
|---|
| 289 | 281 | buf->vaddr = vmalloc_32(nr_pages << PAGE_SHIFT); |
|---|
| 290 | 282 | if (!buf->vaddr) { |
|---|
| 291 | | - dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages); |
|---|
| 283 | + dprintk(1, "vmalloc_32(%lu pages) failed\n", nr_pages); |
|---|
| 292 | 284 | return -ENOMEM; |
|---|
| 293 | 285 | } |
|---|
| 294 | 286 | |
|---|
| 295 | | - dprintk(1, "vmalloc is at addr %p, size=%d\n", |
|---|
| 287 | + dprintk(1, "vmalloc is at addr %p, size=%lu\n", |
|---|
| 296 | 288 | buf->vaddr, nr_pages << PAGE_SHIFT); |
|---|
| 297 | 289 | |
|---|
| 298 | 290 | memset(buf->vaddr, 0, nr_pages << PAGE_SHIFT); |
|---|
| .. | .. |
|---|
| 325 | 317 | struct cx88_audio_buffer *buf = dev->buf; |
|---|
| 326 | 318 | |
|---|
| 327 | 319 | buf->sglen = dma_map_sg(&dev->pci->dev, buf->sglist, |
|---|
| 328 | | - buf->nr_pages, PCI_DMA_FROMDEVICE); |
|---|
| 320 | + buf->nr_pages, DMA_FROM_DEVICE); |
|---|
| 329 | 321 | |
|---|
| 330 | 322 | if (buf->sglen == 0) { |
|---|
| 331 | 323 | pr_warn("%s: cx88_alsa_map_sg failed\n", __func__); |
|---|
| .. | .. |
|---|
| 341 | 333 | if (!buf->sglen) |
|---|
| 342 | 334 | return 0; |
|---|
| 343 | 335 | |
|---|
| 344 | | - dma_unmap_sg(&dev->pci->dev, buf->sglist, buf->sglen, |
|---|
| 345 | | - PCI_DMA_FROMDEVICE); |
|---|
| 336 | + dma_unmap_sg(&dev->pci->dev, buf->sglist, buf->nr_pages, |
|---|
| 337 | + DMA_FROM_DEVICE); |
|---|
| 346 | 338 | buf->sglen = 0; |
|---|
| 347 | 339 | return 0; |
|---|
| 348 | 340 | } |
|---|
| .. | .. |
|---|
| 594 | 586 | static const struct snd_pcm_ops snd_cx88_pcm_ops = { |
|---|
| 595 | 587 | .open = snd_cx88_pcm_open, |
|---|
| 596 | 588 | .close = snd_cx88_close, |
|---|
| 597 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 598 | 589 | .hw_params = snd_cx88_hw_params, |
|---|
| 599 | 590 | .hw_free = snd_cx88_hw_free, |
|---|
| 600 | 591 | .prepare = snd_cx88_prepare, |
|---|
| .. | .. |
|---|
| 616 | 607 | if (err < 0) |
|---|
| 617 | 608 | return err; |
|---|
| 618 | 609 | pcm->private_data = chip; |
|---|
| 619 | | - strcpy(pcm->name, name); |
|---|
| 610 | + strscpy(pcm->name, name, sizeof(pcm->name)); |
|---|
| 620 | 611 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_cx88_pcm_ops); |
|---|
| 621 | 612 | |
|---|
| 622 | 613 | return 0; |
|---|
| .. | .. |
|---|
| 968 | 959 | goto error; |
|---|
| 969 | 960 | } |
|---|
| 970 | 961 | |
|---|
| 971 | | - strcpy(card->driver, "CX88x"); |
|---|
| 962 | + strscpy(card->driver, "CX88x", sizeof(card->driver)); |
|---|
| 972 | 963 | sprintf(card->shortname, "Conexant CX%x", pci->device); |
|---|
| 973 | 964 | sprintf(card->longname, "%s at %#llx", |
|---|
| 974 | 965 | card->shortname, |
|---|
| 975 | 966 | (unsigned long long)pci_resource_start(pci, 0)); |
|---|
| 976 | | - strcpy(card->mixername, "CX88"); |
|---|
| 967 | + strscpy(card->mixername, "CX88", sizeof(card->mixername)); |
|---|
| 977 | 968 | |
|---|
| 978 | 969 | dprintk(0, "%s/%i: ALSA support for cx2388x boards\n", |
|---|
| 979 | 970 | card->driver, devno); |
|---|