forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/sound/firewire/oxfw/oxfw-midi.c
....@@ -1,9 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * oxfw_midi.c - a part of driver for OXFW970/971 based devices
34 *
45 * Copyright (c) 2014 Takashi Sakamoto
5
- *
6
- * Licensed under the terms of the GNU General Public License, version 2.
76 */
87
98 #include "oxfw.h"
....@@ -19,8 +18,13 @@
1918
2019 mutex_lock(&oxfw->mutex);
2120
22
- oxfw->capture_substreams++;
23
- err = snd_oxfw_stream_start_simplex(oxfw, &oxfw->tx_stream, 0, 0);
21
+ err = snd_oxfw_stream_reserve_duplex(oxfw, &oxfw->tx_stream, 0, 0, 0, 0);
22
+ if (err >= 0) {
23
+ ++oxfw->substreams_count;
24
+ err = snd_oxfw_stream_start_duplex(oxfw);
25
+ if (err < 0)
26
+ --oxfw->substreams_count;
27
+ }
2428
2529 mutex_unlock(&oxfw->mutex);
2630
....@@ -41,8 +45,11 @@
4145
4246 mutex_lock(&oxfw->mutex);
4347
44
- oxfw->playback_substreams++;
45
- err = snd_oxfw_stream_start_simplex(oxfw, &oxfw->rx_stream, 0, 0);
48
+ err = snd_oxfw_stream_reserve_duplex(oxfw, &oxfw->rx_stream, 0, 0, 0, 0);
49
+ if (err >= 0) {
50
+ ++oxfw->substreams_count;
51
+ err = snd_oxfw_stream_start_duplex(oxfw);
52
+ }
4653
4754 mutex_unlock(&oxfw->mutex);
4855
....@@ -58,8 +65,8 @@
5865
5966 mutex_lock(&oxfw->mutex);
6067
61
- oxfw->capture_substreams--;
62
- snd_oxfw_stream_stop_simplex(oxfw, &oxfw->tx_stream);
68
+ --oxfw->substreams_count;
69
+ snd_oxfw_stream_stop_duplex(oxfw);
6370
6471 mutex_unlock(&oxfw->mutex);
6572
....@@ -73,8 +80,8 @@
7380
7481 mutex_lock(&oxfw->mutex);
7582
76
- oxfw->playback_substreams--;
77
- snd_oxfw_stream_stop_simplex(oxfw, &oxfw->rx_stream);
83
+ --oxfw->substreams_count;
84
+ snd_oxfw_stream_stop_duplex(oxfw);
7885
7986 mutex_unlock(&oxfw->mutex);
8087