ASoC: tegra: Use guard() for mutex locks

Clean up the code using guard() for mutex locks.
Merely code refactoring, and no behavior change.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Link: https://patch.msgid.link/20260429102743.103197-1-phucduc.bui@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
bui duc phuc 2026-04-29 17:27:43 +07:00 committed by Mark Brown
parent fca2abdf1d
commit b5a1493d94
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -56,19 +56,18 @@ int tegra_isomgr_adma_setbw(struct snd_pcm_substream *substream,
sample_bytes;
}
mutex_lock(&adma_isomgr->mutex);
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;
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];
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);