Skip to content

Commit e18f6bc

Browse files
krzkbroonie
authored andcommitted
ASoC: wcd-mbhc-v2: Revert "ASoC: wcd-mbhc-v2: use pm_runtime_resume_and_get()"
This reverts commit ddea4bb ("ASoC: wcd-mbhc-v2: use pm_runtime_resume_and_get()"), because it introduced double runtime PM put if pm_runtime_get_sync() returns -EACCES: wcd934x-codec wcd934x-codec.3.auto: WCD934X Minor:0x1 Version:0x401 wcd934x-codec wcd934x-codec.3.auto: Runtime PM usage count underflow! The commit claimed no changes in functionality except dropping the reference on -EACCESS. This is exactly the change introducing bug because function calls unconditionally pm_runtime_put_autosuspend() at the end. Fixes: ddea4bb ("ASoC: wcd-mbhc-v2: use pm_runtime_resume_and_get()") Signed-off-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 086cead commit e18f6bc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

sound/soc/codecs/wcd-mbhc-v2.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -714,11 +714,12 @@ static int wcd_mbhc_initialise(struct wcd_mbhc *mbhc)
714714
struct snd_soc_component *component = mbhc->component;
715715
int ret;
716716

717-
ret = pm_runtime_resume_and_get(component->dev);
717+
ret = pm_runtime_get_sync(component->dev);
718718
if (ret < 0 && ret != -EACCES) {
719719
dev_err_ratelimited(component->dev,
720-
"pm_runtime_resume_and_get failed in %s, ret %d\n",
720+
"pm_runtime_get_sync failed in %s, ret %d\n",
721721
__func__, ret);
722+
pm_runtime_put_noidle(component->dev);
722723
return ret;
723724
}
724725

@@ -1096,11 +1097,12 @@ static void wcd_correct_swch_plug(struct work_struct *work)
10961097
mbhc = container_of(work, struct wcd_mbhc, correct_plug_swch);
10971098
component = mbhc->component;
10981099

1099-
ret = pm_runtime_resume_and_get(component->dev);
1100+
ret = pm_runtime_get_sync(component->dev);
11001101
if (ret < 0 && ret != -EACCES) {
11011102
dev_err_ratelimited(component->dev,
1102-
"pm_runtime_resume_and_get failed in %s, ret %d\n",
1103+
"pm_runtime_get_sync failed in %s, ret %d\n",
11031104
__func__, ret);
1105+
pm_runtime_put_noidle(component->dev);
11041106
return;
11051107
}
11061108
micbias_mv = wcd_mbhc_get_micbias(mbhc);

0 commit comments

Comments
 (0)