hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/sound/pci/atiixp_modem.c
....@@ -1,22 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * ALSA driver for ATI IXP 150/200/250 AC97 modem controllers
34 *
45 * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- *
206 */
217
228 #include <linux/io.h>
....@@ -335,7 +321,7 @@
335321 return -ENOMEM;
336322
337323 if (dma->desc_buf.area == NULL) {
338
- if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
324
+ if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
339325 ATI_DESC_LIST_SIZE, &dma->desc_buf) < 0)
340326 return -ENOMEM;
341327 dma->period_bytes = dma->periods = 0; /* clear */
....@@ -797,9 +783,6 @@
797783 int err;
798784 int i;
799785
800
- err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
801
- if (err < 0)
802
- return err;
803786 dma->buf_addr = substream->runtime->dma_addr;
804787 dma->buf_bytes = params_buffer_bytes(hw_params);
805788
....@@ -826,7 +809,6 @@
826809 struct atiixp_dma *dma = substream->runtime->private_data;
827810
828811 atiixp_clear_dma_packets(chip, dma, substream);
829
- snd_pcm_lib_free_pages(substream);
830812 return 0;
831813 }
832814
....@@ -950,7 +932,6 @@
950932 static const struct snd_pcm_ops snd_atiixp_playback_ops = {
951933 .open = snd_atiixp_playback_open,
952934 .close = snd_atiixp_playback_close,
953
- .ioctl = snd_pcm_lib_ioctl,
954935 .hw_params = snd_atiixp_pcm_hw_params,
955936 .hw_free = snd_atiixp_pcm_hw_free,
956937 .prepare = snd_atiixp_playback_prepare,
....@@ -962,7 +943,6 @@
962943 static const struct snd_pcm_ops snd_atiixp_capture_ops = {
963944 .open = snd_atiixp_capture_open,
964945 .close = snd_atiixp_capture_close,
965
- .ioctl = snd_pcm_lib_ioctl,
966946 .hw_params = snd_atiixp_pcm_hw_params,
967947 .hw_free = snd_atiixp_pcm_hw_free,
968948 .prepare = snd_atiixp_capture_prepare,
....@@ -1008,9 +988,8 @@
1008988 strcpy(pcm->name, "ATI IXP MC97");
1009989 chip->pcmdevs[ATI_PCMDEV_ANALOG] = pcm;
1010990
1011
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1012
- snd_dma_pci_data(chip->pci),
1013
- 64*1024, 128*1024);
991
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
992
+ &chip->pci->dev, 64*1024, 128*1024);
1014993
1015994 return 0;
1016995 }
....@@ -1067,11 +1046,11 @@
10671046 struct snd_ac97_template ac97;
10681047 int i, err;
10691048 int codec_count;
1070
- static struct snd_ac97_bus_ops ops = {
1049
+ static const struct snd_ac97_bus_ops ops = {
10711050 .write = snd_atiixp_ac97_write,
10721051 .read = snd_atiixp_ac97_read,
10731052 };
1074
- static unsigned int codec_skip[NUM_ATI_CODECS] = {
1053
+ static const unsigned int codec_skip[NUM_ATI_CODECS] = {
10751054 ATI_REG_ISR_CODEC0_NOT_READY,
10761055 ATI_REG_ISR_CODEC1_NOT_READY,
10771056 ATI_REG_ISR_CODEC2_NOT_READY,
....@@ -1125,8 +1104,6 @@
11251104 int i;
11261105
11271106 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
1128
- for (i = 0; i < NUM_ATI_PCMDEVS; i++)
1129
- snd_pcm_suspend_all(chip->pcmdevs[i]);
11301107 for (i = 0; i < NUM_ATI_CODECS; i++)
11311108 snd_ac97_suspend(chip->ac97[i]);
11321109 snd_atiixp_aclink_down(chip);
....@@ -1172,10 +1149,8 @@
11721149
11731150 static void snd_atiixp_proc_init(struct atiixp_modem *chip)
11741151 {
1175
- struct snd_info_entry *entry;
1176
-
1177
- if (! snd_card_proc_new(chip->card, "atiixp-modem", &entry))
1178
- snd_info_set_text_ops(entry, chip, snd_atiixp_proc_read);
1152
+ snd_card_ro_proc_new(chip->card, "atiixp-modem", chip,
1153
+ snd_atiixp_proc_read);
11791154 }
11801155
11811156
....@@ -1212,7 +1187,7 @@
12121187 struct pci_dev *pci,
12131188 struct atiixp_modem **r_chip)
12141189 {
1215
- static struct snd_device_ops ops = {
1190
+ static const struct snd_device_ops ops = {
12161191 .dev_free = snd_atiixp_dev_free,
12171192 };
12181193 struct atiixp_modem *chip;
....@@ -1252,8 +1227,8 @@
12521227 return -EBUSY;
12531228 }
12541229 chip->irq = pci->irq;
1230
+ card->sync_irq = chip->irq;
12551231 pci_set_master(pci);
1256
- synchronize_irq(chip->irq);
12571232
12581233 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
12591234 snd_atiixp_free(chip);