| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * digi00x-midi.h - a part of driver for Digidesign Digi 002/003 family |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2014-2015 Takashi Sakamoto |
|---|
| 5 | | - * |
|---|
| 6 | | - * Licensed under the terms of the GNU General Public License, version 2. |
|---|
| 7 | 6 | */ |
|---|
| 8 | 7 | |
|---|
| 9 | 8 | #include "digi00x.h" |
|---|
| .. | .. |
|---|
| 18 | 17 | return err; |
|---|
| 19 | 18 | |
|---|
| 20 | 19 | mutex_lock(&dg00x->mutex); |
|---|
| 21 | | - dg00x->substreams_counter++; |
|---|
| 22 | | - err = snd_dg00x_stream_start_duplex(dg00x, 0); |
|---|
| 20 | + err = snd_dg00x_stream_reserve_duplex(dg00x, 0, 0, 0); |
|---|
| 21 | + if (err >= 0) { |
|---|
| 22 | + ++dg00x->substreams_counter; |
|---|
| 23 | + err = snd_dg00x_stream_start_duplex(dg00x); |
|---|
| 24 | + if (err < 0) |
|---|
| 25 | + --dg00x->substreams_counter; |
|---|
| 26 | + } |
|---|
| 23 | 27 | mutex_unlock(&dg00x->mutex); |
|---|
| 24 | 28 | if (err < 0) |
|---|
| 25 | 29 | snd_dg00x_stream_lock_release(dg00x); |
|---|
| .. | .. |
|---|
| 32 | 36 | struct snd_dg00x *dg00x = substream->rmidi->private_data; |
|---|
| 33 | 37 | |
|---|
| 34 | 38 | mutex_lock(&dg00x->mutex); |
|---|
| 35 | | - dg00x->substreams_counter--; |
|---|
| 39 | + --dg00x->substreams_counter; |
|---|
| 36 | 40 | snd_dg00x_stream_stop_duplex(dg00x); |
|---|
| 37 | 41 | mutex_unlock(&dg00x->mutex); |
|---|
| 38 | 42 | |
|---|