diff options
| author | bui duc phuc <phucduc.bui@gmail.com> | 2026-04-29 13:27:43 +0300 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-05-04 16:06:32 +0300 |
| commit | b5a1493d9479b60310ca0d33402ad7cef7ca358e (patch) | |
| tree | 0bbde1c4705eff926228f54519c2011edfaa7968 | |
| parent | fca2abdf1dd7b2aff0167faeed95f6e54385234a (diff) | |
| download | linux-b5a1493d9479b60310ca0d33402ad7cef7ca358e.tar.xz | |
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>
| -rw-r--r-- | sound/soc/tegra/tegra_isomgr_bw.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/sound/soc/tegra/tegra_isomgr_bw.c b/sound/soc/tegra/tegra_isomgr_bw.c index c0f300fb3d38..1c007f870759 100644 --- a/sound/soc/tegra/tegra_isomgr_bw.c +++ b/sound/soc/tegra/tegra_isomgr_bw.c @@ -56,19 +56,18 @@ int tegra_isomgr_adma_setbw(struct snd_pcm_substream *substream, 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); |
