hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/sound/firewire/isight.c
....@@ -1,8 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Apple iSight audio driver
34 *
45 * Copyright (c) Clemens Ladisch <clemens@ladisch.de>
5
- * Licensed under the terms of the GNU General Public License, version 2.
66 */
77
88 #include <asm/byteorder.h>
....@@ -286,12 +286,6 @@
286286 struct snd_pcm_hw_params *hw_params)
287287 {
288288 struct isight *isight = substream->private_data;
289
- int err;
290
-
291
- err = snd_pcm_lib_alloc_vmalloc_buffer(substream,
292
- params_buffer_bytes(hw_params));
293
- if (err < 0)
294
- return err;
295289
296290 WRITE_ONCE(isight->pcm_active, true);
297291
....@@ -337,7 +331,7 @@
337331 isight_stop_streaming(isight);
338332 mutex_unlock(&isight->mutex);
339333
340
- return snd_pcm_lib_free_vmalloc_buffer(substream);
334
+ return 0;
341335 }
342336
343337 static int isight_start_streaming(struct isight *isight)
....@@ -447,13 +441,11 @@
447441 static const struct snd_pcm_ops ops = {
448442 .open = isight_open,
449443 .close = isight_close,
450
- .ioctl = snd_pcm_lib_ioctl,
451444 .hw_params = isight_hw_params,
452445 .hw_free = isight_hw_free,
453446 .prepare = isight_prepare,
454447 .trigger = isight_trigger,
455448 .pointer = isight_pointer,
456
- .page = snd_pcm_lib_get_vmalloc_page,
457449 };
458450 struct snd_pcm *pcm;
459451 int err;
....@@ -465,6 +457,7 @@
465457 strcpy(pcm->name, "iSight");
466458 isight->pcm = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
467459 isight->pcm->ops = &ops;
460
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC, NULL, 0, 0);
468461
469462 return 0;
470463 }
....@@ -602,8 +595,6 @@
602595 struct isight *isight = card->private_data;
603596
604597 fw_iso_resources_destroy(&isight->resources);
605
- fw_unit_put(isight->unit);
606
- mutex_destroy(&isight->mutex);
607598 }
608599
609600 static u64 get_unit_base(struct fw_unit *unit)
....@@ -703,7 +694,11 @@
703694 isight_stop_streaming(isight);
704695 mutex_unlock(&isight->mutex);
705696
706
- snd_card_free_when_closed(isight->card);
697
+ // Block till all of ALSA character devices are released.
698
+ snd_card_free(isight->card);
699
+
700
+ mutex_destroy(&isight->mutex);
701
+ fw_unit_put(isight->unit);
707702 }
708703
709704 static const struct ieee1394_device_id isight_id_table[] = {