hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/sound/pci/lx6464es/lx6464es.c
....@@ -1,25 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /* -*- linux-c -*- *
23 *
34 * ALSA driver for the digigram lx6464es interface
45 *
56 * Copyright (c) 2008, 2009 Tim Blechmann <tim@klingt.org>
6
- *
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program; see the file COPYING. If not, write to
20
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21
- * Boston, MA 02111-1307, USA.
22
- *
237 */
248
259 #include <linux/module.h>
....@@ -277,9 +261,8 @@
277261
278262 static int lx_pcm_close(struct snd_pcm_substream *substream)
279263 {
280
- int err = 0;
281264 dev_dbg(substream->pcm->card->dev, "->lx_pcm_close\n");
282
- return err;
265
+ return 0;
283266 }
284267
285268 static snd_pcm_uframes_t lx_pcm_stream_pointer(struct snd_pcm_substream
....@@ -359,15 +342,10 @@
359342 struct snd_pcm_hw_params *hw_params, int is_capture)
360343 {
361344 struct lx6464es *chip = snd_pcm_substream_chip(substream);
362
- int err = 0;
363345
364346 dev_dbg(chip->card->dev, "->lx_pcm_hw_params\n");
365347
366348 mutex_lock(&chip->setup_mutex);
367
-
368
- /* set dma buffer */
369
- err = snd_pcm_lib_malloc_pages(substream,
370
- params_buffer_bytes(hw_params));
371349
372350 if (is_capture)
373351 chip->capture_stream.stream = substream;
....@@ -375,7 +353,7 @@
375353 chip->playback_stream.stream = substream;
376354
377355 mutex_unlock(&chip->setup_mutex);
378
- return err;
356
+ return 0;
379357 }
380358
381359 static int lx_pcm_hw_params_playback(struct snd_pcm_substream *substream,
....@@ -416,8 +394,6 @@
416394
417395 chip->hardware_running[is_capture] = 0;
418396 }
419
-
420
- err = snd_pcm_lib_free_pages(substream);
421397
422398 if (is_capture)
423399 chip->capture_stream.stream = NULL;
....@@ -815,7 +791,6 @@
815791 static const struct snd_pcm_ops lx_ops_playback = {
816792 .open = lx_pcm_open,
817793 .close = lx_pcm_close,
818
- .ioctl = snd_pcm_lib_ioctl,
819794 .prepare = lx_pcm_prepare,
820795 .hw_params = lx_pcm_hw_params_playback,
821796 .hw_free = lx_pcm_hw_free,
....@@ -826,7 +801,6 @@
826801 static const struct snd_pcm_ops lx_ops_capture = {
827802 .open = lx_pcm_open,
828803 .close = lx_pcm_close,
829
- .ioctl = snd_pcm_lib_ioctl,
830804 .prepare = lx_pcm_prepare,
831805 .hw_params = lx_pcm_hw_params_capture,
832806 .hw_free = lx_pcm_hw_free,
....@@ -862,11 +836,8 @@
862836 pcm->nonatomic = true;
863837 strcpy(pcm->name, card_name);
864838
865
- err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
866
- snd_dma_pci_data(chip->pci),
867
- size, size);
868
- if (err < 0)
869
- return err;
839
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
840
+ &chip->pci->dev, size, size);
870841
871842 chip->pcm = pcm;
872843 chip->capture_stream.is_capture = 1;
....@@ -956,13 +927,7 @@
956927
957928 static int lx_proc_create(struct snd_card *card, struct lx6464es *chip)
958929 {
959
- struct snd_info_entry *entry;
960
- int err = snd_card_proc_new(card, "levels", &entry);
961
- if (err < 0)
962
- return err;
963
-
964
- snd_info_set_text_ops(entry, chip, lx_proc_levels_read);
965
- return 0;
930
+ return snd_card_ro_proc_new(card, "levels", chip, lx_proc_levels_read);
966931 }
967932
968933
....@@ -973,7 +938,7 @@
973938 struct lx6464es *chip;
974939 int err;
975940
976
- static struct snd_device_ops ops = {
941
+ static const struct snd_device_ops ops = {
977942 .dev_free = snd_lx6464es_dev_free,
978943 };
979944
....@@ -1037,6 +1002,7 @@
10371002 goto request_irq_failed;
10381003 }
10391004 chip->irq = pci->irq;
1005
+ card->sync_irq = chip->irq;
10401006
10411007 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
10421008 if (err < 0)