ASoC: Intel: bdw-rt5677: fix module load/unload issues
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Mon, 22 Jun 2020 15:42:38 +0000 (10:42 -0500)
committerMark Brown <broonie@kernel.org>
Tue, 23 Jun 2020 11:25:38 +0000 (12:25 +0100)
commitbcb43fdae1c0d08b772b792cf46f323ad0d17968
tree230b01df5f96118dfe43a9c1f55e293ceca53c37
parent21a00fb33790f828a34b9ce50ab9f9130bc1ffb4
ASoC: Intel: bdw-rt5677: fix module load/unload issues

The mainline code currently prevents modules from being removed.

The BE dailink .init() function calls devm_gpiod_get() using the codec
component device as argument. When the machine driver is removed, the
references to the gpiod are not released, and it's not possible to
remove the codec driver module - which is the only entity which could
free the gpiod.

This conceptual deadlock can be avoided by invoking gpiod_get() in the
.init() callback, and calling gpiod_put() in the exit() callback.

Tested on SAMUS Chromebook with SOF driver.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Curtis Malainey <curtis@malainey.com>
Link: https://lore.kernel.org/r/20200622154241.29053-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/boards/bdw-rt5677.c