Skip to content

Commit 4a0a047

Browse files
takaswietiwai
authored andcommitted
ALSA: oxfw: unify substreams counter
In former commits, two isochronous contexts are handles at the same time. This commit unifies stream counters to obsolete them. Signed-off-by: Takashi Sakamoto <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent 779f0db commit 4a0a047

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

sound/firewire/oxfw/oxfw-midi.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ static int midi_capture_open(struct snd_rawmidi_substream *substream)
1919

2020
mutex_lock(&oxfw->mutex);
2121

22-
oxfw->capture_substreams++;
22+
++oxfw->substreams_count;
2323
err = snd_oxfw_stream_start_duplex(oxfw, &oxfw->tx_stream, 0, 0);
2424

2525
mutex_unlock(&oxfw->mutex);
@@ -41,7 +41,7 @@ static int midi_playback_open(struct snd_rawmidi_substream *substream)
4141

4242
mutex_lock(&oxfw->mutex);
4343

44-
oxfw->playback_substreams++;
44+
++oxfw->substreams_count;
4545
err = snd_oxfw_stream_start_duplex(oxfw, &oxfw->rx_stream, 0, 0);
4646

4747
mutex_unlock(&oxfw->mutex);
@@ -58,7 +58,7 @@ static int midi_capture_close(struct snd_rawmidi_substream *substream)
5858

5959
mutex_lock(&oxfw->mutex);
6060

61-
oxfw->capture_substreams--;
61+
--oxfw->substreams_count;
6262
snd_oxfw_stream_stop_duplex(oxfw);
6363

6464
mutex_unlock(&oxfw->mutex);
@@ -73,7 +73,7 @@ static int midi_playback_close(struct snd_rawmidi_substream *substream)
7373

7474
mutex_lock(&oxfw->mutex);
7575

76-
oxfw->playback_substreams--;
76+
--oxfw->substreams_count;
7777
snd_oxfw_stream_stop_duplex(oxfw);
7878

7979
mutex_unlock(&oxfw->mutex);

sound/firewire/oxfw/oxfw-pcm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static int pcm_capture_hw_params(struct snd_pcm_substream *substream,
220220

221221
if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN) {
222222
mutex_lock(&oxfw->mutex);
223-
oxfw->capture_substreams++;
223+
++oxfw->substreams_count;
224224
mutex_unlock(&oxfw->mutex);
225225
}
226226

@@ -239,7 +239,7 @@ static int pcm_playback_hw_params(struct snd_pcm_substream *substream,
239239

240240
if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN) {
241241
mutex_lock(&oxfw->mutex);
242-
oxfw->playback_substreams++;
242+
++oxfw->substreams_count;
243243
mutex_unlock(&oxfw->mutex);
244244
}
245245

@@ -253,7 +253,7 @@ static int pcm_capture_hw_free(struct snd_pcm_substream *substream)
253253
mutex_lock(&oxfw->mutex);
254254

255255
if (substream->runtime->status->state != SNDRV_PCM_STATE_OPEN)
256-
oxfw->capture_substreams--;
256+
--oxfw->substreams_count;
257257

258258
snd_oxfw_stream_stop_duplex(oxfw);
259259

@@ -268,7 +268,7 @@ static int pcm_playback_hw_free(struct snd_pcm_substream *substream)
268268
mutex_lock(&oxfw->mutex);
269269

270270
if (substream->runtime->status->state != SNDRV_PCM_STATE_OPEN)
271-
oxfw->playback_substreams--;
271+
--oxfw->substreams_count;
272272

273273
snd_oxfw_stream_stop_duplex(oxfw);
274274

sound/firewire/oxfw/oxfw-stream.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ int snd_oxfw_stream_start_duplex(struct snd_oxfw *oxfw,
244244
enum avc_general_plug_dir dir;
245245
int err = 0;
246246

247-
if (oxfw->capture_substreams == 0 && oxfw->playback_substreams == 0)
247+
if (oxfw->substreams_count == 0)
248248
return -EIO;
249249

250250
// Considering JACK/FFADO streaming:
@@ -323,7 +323,7 @@ int snd_oxfw_stream_start_duplex(struct snd_oxfw *oxfw,
323323

324324
void snd_oxfw_stream_stop_duplex(struct snd_oxfw *oxfw)
325325
{
326-
if (oxfw->capture_substreams == 0 && oxfw->playback_substreams == 0) {
326+
if (oxfw->substreams_count == 0) {
327327
amdtp_stream_stop(&oxfw->rx_stream);
328328
cmp_connection_break(&oxfw->in_conn);
329329

sound/firewire/oxfw/oxfw.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ struct snd_oxfw {
5252
struct cmp_connection in_conn;
5353
struct amdtp_stream tx_stream;
5454
struct amdtp_stream rx_stream;
55-
unsigned int capture_substreams;
56-
unsigned int playback_substreams;
55+
unsigned int substreams_count;
5756

5857
unsigned int midi_input_ports;
5958
unsigned int midi_output_ports;

0 commit comments

Comments
 (0)