sample_bytes;
}
- mutex_lock(&adma_isomgr->mutex);
-
- if (is_running) {
- if (bandwidth + adma_isomgr->current_bandwidth > adma_isomgr->max_bw)
- bandwidth = adma_isomgr->max_bw - adma_isomgr->current_bandwidth;
-
- adma_isomgr->current_bandwidth += bandwidth;
- } else {
- adma_isomgr->current_bandwidth -= adma_isomgr->bw_per_dev[type][pcm->device];
+ scoped_guard(mutex, &adma_isomgr->mutex) {
+ if (is_running) {
+ if (bandwidth + adma_isomgr->current_bandwidth > adma_isomgr->max_bw)
+ bandwidth = adma_isomgr->max_bw - adma_isomgr->current_bandwidth;
+
+ adma_isomgr->current_bandwidth += bandwidth;
+ } else {
+ adma_isomgr->current_bandwidth -=
+ adma_isomgr->bw_per_dev[type][pcm->device];
+ }
}
- mutex_unlock(&adma_isomgr->mutex);
-
adma_isomgr->bw_per_dev[type][pcm->device] = bandwidth;
dev_dbg(dev, "Setting up bandwidth to %d KBps\n", adma_isomgr->current_bandwidth);