| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Apple iSight audio driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) Clemens Ladisch <clemens@ladisch.de> |
|---|
| 5 | | - * Licensed under the terms of the GNU General Public License, version 2. |
|---|
| 6 | 6 | */ |
|---|
| 7 | 7 | |
|---|
| 8 | 8 | #include <asm/byteorder.h> |
|---|
| .. | .. |
|---|
| 286 | 286 | struct snd_pcm_hw_params *hw_params) |
|---|
| 287 | 287 | { |
|---|
| 288 | 288 | 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; |
|---|
| 295 | 289 | |
|---|
| 296 | 290 | WRITE_ONCE(isight->pcm_active, true); |
|---|
| 297 | 291 | |
|---|
| .. | .. |
|---|
| 337 | 331 | isight_stop_streaming(isight); |
|---|
| 338 | 332 | mutex_unlock(&isight->mutex); |
|---|
| 339 | 333 | |
|---|
| 340 | | - return snd_pcm_lib_free_vmalloc_buffer(substream); |
|---|
| 334 | + return 0; |
|---|
| 341 | 335 | } |
|---|
| 342 | 336 | |
|---|
| 343 | 337 | static int isight_start_streaming(struct isight *isight) |
|---|
| .. | .. |
|---|
| 447 | 441 | static const struct snd_pcm_ops ops = { |
|---|
| 448 | 442 | .open = isight_open, |
|---|
| 449 | 443 | .close = isight_close, |
|---|
| 450 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 451 | 444 | .hw_params = isight_hw_params, |
|---|
| 452 | 445 | .hw_free = isight_hw_free, |
|---|
| 453 | 446 | .prepare = isight_prepare, |
|---|
| 454 | 447 | .trigger = isight_trigger, |
|---|
| 455 | 448 | .pointer = isight_pointer, |
|---|
| 456 | | - .page = snd_pcm_lib_get_vmalloc_page, |
|---|
| 457 | 449 | }; |
|---|
| 458 | 450 | struct snd_pcm *pcm; |
|---|
| 459 | 451 | int err; |
|---|
| .. | .. |
|---|
| 465 | 457 | strcpy(pcm->name, "iSight"); |
|---|
| 466 | 458 | isight->pcm = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; |
|---|
| 467 | 459 | isight->pcm->ops = &ops; |
|---|
| 460 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC, NULL, 0, 0); |
|---|
| 468 | 461 | |
|---|
| 469 | 462 | return 0; |
|---|
| 470 | 463 | } |
|---|
| .. | .. |
|---|
| 602 | 595 | struct isight *isight = card->private_data; |
|---|
| 603 | 596 | |
|---|
| 604 | 597 | fw_iso_resources_destroy(&isight->resources); |
|---|
| 605 | | - fw_unit_put(isight->unit); |
|---|
| 606 | | - mutex_destroy(&isight->mutex); |
|---|
| 607 | 598 | } |
|---|
| 608 | 599 | |
|---|
| 609 | 600 | static u64 get_unit_base(struct fw_unit *unit) |
|---|
| .. | .. |
|---|
| 703 | 694 | isight_stop_streaming(isight); |
|---|
| 704 | 695 | mutex_unlock(&isight->mutex); |
|---|
| 705 | 696 | |
|---|
| 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); |
|---|
| 707 | 702 | } |
|---|
| 708 | 703 | |
|---|
| 709 | 704 | static const struct ieee1394_device_id isight_id_table[] = { |
|---|