| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * dice_midi.c - a part of driver for Dice based devices |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2014 Takashi Sakamoto |
|---|
| 5 | | - * |
|---|
| 6 | | - * Licensed under the terms of the GNU General Public License, version 2. |
|---|
| 7 | 6 | */ |
|---|
| 8 | 7 | #include "dice.h" |
|---|
| 9 | 8 | |
|---|
| .. | .. |
|---|
| 18 | 17 | |
|---|
| 19 | 18 | mutex_lock(&dice->mutex); |
|---|
| 20 | 19 | |
|---|
| 21 | | - dice->substreams_counter++; |
|---|
| 22 | | - err = snd_dice_stream_start_duplex(dice, 0); |
|---|
| 20 | + err = snd_dice_stream_reserve_duplex(dice, 0, 0, 0); |
|---|
| 21 | + if (err >= 0) { |
|---|
| 22 | + ++dice->substreams_counter; |
|---|
| 23 | + err = snd_dice_stream_start_duplex(dice); |
|---|
| 24 | + if (err < 0) |
|---|
| 25 | + --dice->substreams_counter; |
|---|
| 26 | + } |
|---|
| 23 | 27 | |
|---|
| 24 | 28 | mutex_unlock(&dice->mutex); |
|---|
| 25 | 29 | |
|---|
| .. | .. |
|---|
| 35 | 39 | |
|---|
| 36 | 40 | mutex_lock(&dice->mutex); |
|---|
| 37 | 41 | |
|---|
| 38 | | - dice->substreams_counter--; |
|---|
| 42 | + --dice->substreams_counter; |
|---|
| 39 | 43 | snd_dice_stream_stop_duplex(dice); |
|---|
| 40 | 44 | |
|---|
| 41 | 45 | mutex_unlock(&dice->mutex); |
|---|