From: bui duc phuc <[email protected]>
Clean up the code using guard() for mutex locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <[email protected]>
---
sound/soc/codecs/rt700-sdw.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/sound/soc/codecs/rt700-sdw.c b/sound/soc/codecs/rt700-sdw.c
index 30fcca210f05..8b15bbc31ac3 100644
--- a/sound/soc/codecs/rt700-sdw.c
+++ b/sound/soc/codecs/rt700-sdw.c
@@ -416,12 +416,11 @@ static int rt700_interrupt_callback(struct sdw_slave *slave,
dev_dbg(&slave->dev,
"%s control_port_stat=%x", __func__, status->control_port);
- mutex_lock(&rt700->disable_irq_lock);
+ guard(mutex)(&rt700->disable_irq_lock);
if (status->control_port & 0x4 && !rt700->disable_irq) {
mod_delayed_work(system_power_efficient_wq,
&rt700->jack_detect_work, msecs_to_jiffies(250));
}
- mutex_unlock(&rt700->disable_irq_lock);
return 0;
}
@@ -502,11 +501,11 @@ static int rt700_dev_system_suspend(struct device *dev)
* deferred work completes and before the parent disables
* interrupts on the link
*/
- mutex_lock(&rt700->disable_irq_lock);
- rt700->disable_irq = true;
- ret = sdw_update_no_pm(slave, SDW_SCP_INTMASK1,
- SDW_SCP_INT1_IMPL_DEF, 0);
- mutex_unlock(&rt700->disable_irq_lock);
+ scoped_guard(mutex, &rt700->disable_irq_lock) {
+ rt700->disable_irq = true;
+ ret = sdw_update_no_pm(slave, SDW_SCP_INTMASK1,
+ SDW_SCP_INT1_IMPL_DEF, 0);
+ }
if (ret < 0) {
/* log but don't prevent suspend from happening */
--
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.