ASoC: Intel: catpt: Fix compilation when CONFIG_MODULES is disabled

module_is_live() is available only when CONFIG_MODULES is enabled.
Replace its usage with try_module_get() which is present regardless of
said config's status.

Fixes: 7a10b66a5d ("ASoC: Intel: catpt: Device driver lifecycle")
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20201007135701.20372-1-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Cezary Rojewski 2020-10-07 15:57:00 +02:00 committed by Mark Brown
parent 6db282c8a9
commit f38d43dafb
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 5 additions and 2 deletions

View File

@ -81,10 +81,11 @@ static int __maybe_unused catpt_resume(struct device *dev)
if (ret)
return ret;
if (!module_is_live(dev->driver->owner)) {
if (!try_module_get(dev->driver->owner)) {
dev_info(dev, "module unloading, skipping fw boot\n");
return 0;
}
module_put(dev->driver->owner);
ret = catpt_boot_firmware(cdev, true);
if (ret) {
@ -107,10 +108,12 @@ static int __maybe_unused catpt_resume(struct device *dev)
static int __maybe_unused catpt_runtime_suspend(struct device *dev)
{
if (!module_is_live(dev->driver->owner)) {
if (!try_module_get(dev->driver->owner)) {
dev_info(dev, "module unloading, skipping suspend\n");
return 0;
}
module_put(dev->driver->owner);
return catpt_suspend(dev);
}