mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-12-04 23:20:56 -06:00
ASoC: codecs: mt6359-accdet: 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/20260721102600.523199-14-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
// Author: Argus Lin <argus.lin@mediatek.com>
|
||||
//
|
||||
|
||||
#include <linux/cleanup.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/kthread.h>
|
||||
@@ -398,14 +399,13 @@ static void mt6359_accdet_work(struct work_struct *work)
|
||||
struct mt6359_accdet *priv =
|
||||
container_of(work, struct mt6359_accdet, accdet_work);
|
||||
|
||||
mutex_lock(&priv->res_lock);
|
||||
guard(mutex)(&priv->res_lock);
|
||||
priv->pre_accdet_status = priv->accdet_status;
|
||||
check_jack_btn_type(priv);
|
||||
|
||||
if (priv->jack_plugged &&
|
||||
priv->pre_accdet_status != priv->accdet_status)
|
||||
mt6359_accdet_jack_report(priv);
|
||||
mutex_unlock(&priv->res_lock);
|
||||
}
|
||||
|
||||
static void mt6359_accdet_jd_work(struct work_struct *work)
|
||||
@@ -416,7 +416,7 @@ static void mt6359_accdet_jd_work(struct work_struct *work)
|
||||
struct mt6359_accdet *priv =
|
||||
container_of(work, struct mt6359_accdet, jd_work);
|
||||
|
||||
mutex_lock(&priv->res_lock);
|
||||
guard(mutex)(&priv->res_lock);
|
||||
if (priv->jd_sts == M_PLUG_IN) {
|
||||
priv->jack_plugged = true;
|
||||
|
||||
@@ -450,7 +450,6 @@ static void mt6359_accdet_jd_work(struct work_struct *work)
|
||||
|
||||
if (priv->caps & ACCDET_PMIC_EINT_IRQ)
|
||||
recover_eint_setting(priv);
|
||||
mutex_unlock(&priv->res_lock);
|
||||
}
|
||||
|
||||
static irqreturn_t mt6359_accdet_irq(int irq, void *data)
|
||||
@@ -459,7 +458,7 @@ static irqreturn_t mt6359_accdet_irq(int irq, void *data)
|
||||
unsigned int irq_val = 0, val = 0, value = 0;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&priv->res_lock);
|
||||
guard(mutex)(&priv->res_lock);
|
||||
regmap_read(priv->regmap, ACCDET_IRQ_ADDR, &irq_val);
|
||||
|
||||
if (irq_val & ACCDET_IRQ_MASK_SFT) {
|
||||
@@ -474,7 +473,6 @@ static irqreturn_t mt6359_accdet_irq(int irq, void *data)
|
||||
1000);
|
||||
if (ret) {
|
||||
dev_err(priv->dev, "%s(), ret %d\n", __func__, ret);
|
||||
mutex_unlock(&priv->res_lock);
|
||||
return IRQ_NONE;
|
||||
}
|
||||
regmap_update_bits(priv->regmap, ACCDET_IRQ_ADDR,
|
||||
@@ -498,7 +496,6 @@ static irqreturn_t mt6359_accdet_irq(int irq, void *data)
|
||||
if (ret) {
|
||||
dev_err(priv->dev, "%s(), ret %d\n", __func__,
|
||||
ret);
|
||||
mutex_unlock(&priv->res_lock);
|
||||
return IRQ_NONE;
|
||||
}
|
||||
regmap_update_bits(priv->regmap, ACCDET_IRQ_ADDR,
|
||||
@@ -521,7 +518,6 @@ static irqreturn_t mt6359_accdet_irq(int irq, void *data)
|
||||
if (ret) {
|
||||
dev_err(priv->dev, "%s(), ret %d\n", __func__,
|
||||
ret);
|
||||
mutex_unlock(&priv->res_lock);
|
||||
return IRQ_NONE;
|
||||
}
|
||||
regmap_update_bits(priv->regmap, ACCDET_IRQ_ADDR,
|
||||
@@ -540,7 +536,6 @@ static irqreturn_t mt6359_accdet_irq(int irq, void *data)
|
||||
|
||||
queue_work(priv->jd_workqueue, &priv->jd_work);
|
||||
}
|
||||
mutex_unlock(&priv->res_lock);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user