mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
ASoC: apple: mca: 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/20260423125154.156257-1-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
0fa63c7ea9
commit
fc86d55e8b
|
|
@ -307,7 +307,7 @@ static bool mca_fe_clocks_in_use(struct mca_cluster *cl)
|
|||
struct mca_cluster *be_cl;
|
||||
int stream, i;
|
||||
|
||||
mutex_lock(&mca->port_mutex);
|
||||
guard(mutex)(&mca->port_mutex);
|
||||
for (i = 0; i < mca->nclusters; i++) {
|
||||
be_cl = &mca->clusters[i];
|
||||
|
||||
|
|
@ -316,12 +316,10 @@ static bool mca_fe_clocks_in_use(struct mca_cluster *cl)
|
|||
|
||||
for_each_pcm_streams(stream) {
|
||||
if (be_cl->clocks_in_use[stream]) {
|
||||
mutex_unlock(&mca->port_mutex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
mutex_unlock(&mca->port_mutex);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -765,9 +763,8 @@ static int mca_be_startup(struct snd_pcm_substream *substream,
|
|||
cl->base + REG_PORT_CLOCK_SEL);
|
||||
writel_relaxed(PORT_DATA_SEL_TXA(fe_cl->no),
|
||||
cl->base + REG_PORT_DATA_SEL);
|
||||
mutex_lock(&mca->port_mutex);
|
||||
cl->port_driver = fe_cl->no;
|
||||
mutex_unlock(&mca->port_mutex);
|
||||
scoped_guard(mutex, &mca->port_mutex)
|
||||
cl->port_driver = fe_cl->no;
|
||||
cl->port_started[substream->stream] = true;
|
||||
|
||||
return 0;
|
||||
|
|
@ -788,9 +785,8 @@ static void mca_be_shutdown(struct snd_pcm_substream *substream,
|
|||
*/
|
||||
writel_relaxed(0, cl->base + REG_PORT_ENABLES);
|
||||
writel_relaxed(0, cl->base + REG_PORT_DATA_SEL);
|
||||
mutex_lock(&mca->port_mutex);
|
||||
cl->port_driver = -1;
|
||||
mutex_unlock(&mca->port_mutex);
|
||||
scoped_guard(mutex, &mca->port_mutex)
|
||||
cl->port_driver = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user