.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * |
---|
3 | 4 | * Support for CX23885 analog audio capture |
---|
.. | .. |
---|
5 | 6 | * (c) 2008 Mijhail Moreyra <mijhail.moreyra@gmail.com> |
---|
6 | 7 | * Adapted from cx88-alsa.c |
---|
7 | 8 | * (c) 2009 Steven Toth <stoth@kernellabs.com> |
---|
8 | | - * |
---|
9 | | - * This program is free software; you can redistribute it and/or modify |
---|
10 | | - * it under the terms of the GNU General Public License as published by |
---|
11 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
12 | | - * (at your option) any later version. |
---|
13 | | - * |
---|
14 | | - * This program is distributed in the hope that it will be useful, |
---|
15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | | - * GNU General Public License for more details. |
---|
18 | 9 | */ |
---|
19 | 10 | |
---|
20 | 11 | #include "cx23885.h" |
---|
.. | .. |
---|
59 | 50 | MODULE_PARM_DESC(audio_debug, "enable debug messages [analog audio]"); |
---|
60 | 51 | |
---|
61 | 52 | /**************************************************************************** |
---|
62 | | - Board specific funtions |
---|
| 53 | + Board specific functions |
---|
63 | 54 | ****************************************************************************/ |
---|
64 | 55 | |
---|
65 | 56 | /* Constants taken from cx88-reg.h */ |
---|
.. | .. |
---|
77 | 68 | #define AUD_INT_MCHG_IRQ (1 << 21) |
---|
78 | 69 | #define GP_COUNT_CONTROL_RESET 0x3 |
---|
79 | 70 | |
---|
80 | | -static int cx23885_alsa_dma_init(struct cx23885_audio_dev *chip, int nr_pages) |
---|
| 71 | +static int cx23885_alsa_dma_init(struct cx23885_audio_dev *chip, |
---|
| 72 | + unsigned long nr_pages) |
---|
81 | 73 | { |
---|
82 | 74 | struct cx23885_audio_buffer *buf = chip->buf; |
---|
83 | 75 | struct page *pg; |
---|
.. | .. |
---|
85 | 77 | |
---|
86 | 78 | buf->vaddr = vmalloc_32(nr_pages << PAGE_SHIFT); |
---|
87 | 79 | if (NULL == buf->vaddr) { |
---|
88 | | - dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages); |
---|
| 80 | + dprintk(1, "vmalloc_32(%lu pages) failed\n", nr_pages); |
---|
89 | 81 | return -ENOMEM; |
---|
90 | 82 | } |
---|
91 | 83 | |
---|
92 | | - dprintk(1, "vmalloc is at addr %p, size=%d\n", |
---|
| 84 | + dprintk(1, "vmalloc is at addr %p, size=%lu\n", |
---|
93 | 85 | buf->vaddr, nr_pages << PAGE_SHIFT); |
---|
94 | 86 | |
---|
95 | 87 | memset(buf->vaddr, 0, nr_pages << PAGE_SHIFT); |
---|
.. | .. |
---|
122 | 114 | struct cx23885_audio_buffer *buf = dev->buf; |
---|
123 | 115 | |
---|
124 | 116 | buf->sglen = dma_map_sg(&dev->pci->dev, buf->sglist, |
---|
125 | | - buf->nr_pages, PCI_DMA_FROMDEVICE); |
---|
| 117 | + buf->nr_pages, DMA_FROM_DEVICE); |
---|
126 | 118 | |
---|
127 | 119 | if (0 == buf->sglen) { |
---|
128 | 120 | pr_warn("%s: cx23885_alsa_map_sg failed\n", __func__); |
---|
.. | .. |
---|
138 | 130 | if (!buf->sglen) |
---|
139 | 131 | return 0; |
---|
140 | 132 | |
---|
141 | | - dma_unmap_sg(&dev->pci->dev, buf->sglist, buf->sglen, PCI_DMA_FROMDEVICE); |
---|
| 133 | + dma_unmap_sg(&dev->pci->dev, buf->sglist, buf->nr_pages, DMA_FROM_DEVICE); |
---|
142 | 134 | buf->sglen = 0; |
---|
143 | 135 | return 0; |
---|
144 | 136 | } |
---|
.. | .. |
---|
504 | 496 | static const struct snd_pcm_ops snd_cx23885_pcm_ops = { |
---|
505 | 497 | .open = snd_cx23885_pcm_open, |
---|
506 | 498 | .close = snd_cx23885_close, |
---|
507 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
508 | 499 | .hw_params = snd_cx23885_hw_params, |
---|
509 | 500 | .hw_free = snd_cx23885_hw_free, |
---|
510 | 501 | .prepare = snd_cx23885_prepare, |
---|
.. | .. |
---|
526 | 517 | if (err < 0) |
---|
527 | 518 | return err; |
---|
528 | 519 | pcm->private_data = chip; |
---|
529 | | - strcpy(pcm->name, name); |
---|
| 520 | + strscpy(pcm->name, name, sizeof(pcm->name)); |
---|
530 | 521 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_cx23885_pcm_ops); |
---|
531 | 522 | |
---|
532 | 523 | return 0; |
---|
.. | .. |
---|
571 | 562 | if (err < 0) |
---|
572 | 563 | goto error; |
---|
573 | 564 | |
---|
574 | | - strcpy(card->driver, "CX23885"); |
---|
| 565 | + strscpy(card->driver, "CX23885", sizeof(card->driver)); |
---|
575 | 566 | sprintf(card->shortname, "Conexant CX23885"); |
---|
576 | 567 | sprintf(card->longname, "%s at %s", card->shortname, dev->name); |
---|
577 | 568 | |
---|