]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ASoC: rt711-sdca-sdw: fix calibrate mutex initialization
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Mon, 6 Jun 2022 20:37:47 +0000 (15:37 -0500)
committerMark Brown <broonie@kernel.org>
Fri, 24 Jun 2022 15:21:31 +0000 (16:21 +0100)
In codec driver bind/unbind test, the following warning is thrown:

DEBUG_LOCKS_WARN_ON(lock->magic != lock)
...
[  699.182495]  rt711_sdca_jack_init+0x1b/0x1d0 [snd_soc_rt711_sdca]
[  699.182498]  rt711_sdca_set_jack_detect+0x3b/0x90 [snd_soc_rt711_sdca]
[  699.182500]  snd_soc_component_set_jack+0x24/0x50 [snd_soc_core]

A quick check in the code shows that the 'calibrate_mutex' used by
this driver are not initialized at probe time. Moving the
initialization to the probe removes the issue.

BugLink: https://github.com/thesofproject/linux/issues/3644
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220606203752.144159-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt711-sdca-sdw.c
sound/soc/codecs/rt711-sdca.c

index c722a2b0041f7257169e9558e9fc15d704199239..a085b2f530aa1d268135f3f259ef3b4a72c0c7b8 100644 (file)
@@ -373,6 +373,9 @@ static int rt711_sdca_sdw_remove(struct sdw_slave *slave)
        if (rt711->first_hw_init)
                pm_runtime_disable(&slave->dev);
 
+       mutex_destroy(&rt711->calibrate_mutex);
+       mutex_destroy(&rt711->disable_irq_lock);
+
        return 0;
 }
 
index 57629c18db384126c53e30e157cdeddde05529d5..af73bcb4560a3fe8a6cca133abccc078a5f51b57 100644 (file)
@@ -1412,6 +1412,7 @@ int rt711_sdca_init(struct device *dev, struct regmap *regmap,
        rt711->regmap = regmap;
        rt711->mbq_regmap = mbq_regmap;
 
+       mutex_init(&rt711->calibrate_mutex);
        mutex_init(&rt711->disable_irq_lock);
 
        /*
@@ -1550,7 +1551,6 @@ int rt711_sdca_io_init(struct device *dev, struct sdw_slave *slave)
                        rt711_sdca_jack_detect_handler);
                INIT_DELAYED_WORK(&rt711->jack_btn_check_work,
                        rt711_sdca_btn_check_handler);
-               mutex_init(&rt711->calibrate_mutex);
        }
 
        /* calibration */