Commit f38d43da authored by Cezary Rojewski's avatar Cezary Rojewski Committed by Mark Brown

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: 7a10b66a ("ASoC: Intel: catpt: Device driver lifecycle")
Reported-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Signed-off-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20201007135701.20372-1-cezary.rojewski@intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6db282c8
...@@ -81,10 +81,11 @@ static int __maybe_unused catpt_resume(struct device *dev) ...@@ -81,10 +81,11 @@ static int __maybe_unused catpt_resume(struct device *dev)
if (ret) if (ret)
return 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"); dev_info(dev, "module unloading, skipping fw boot\n");
return 0; return 0;
} }
module_put(dev->driver->owner);
ret = catpt_boot_firmware(cdev, true); ret = catpt_boot_firmware(cdev, true);
if (ret) { if (ret) {
...@@ -107,10 +108,12 @@ static int __maybe_unused catpt_resume(struct device *dev) ...@@ -107,10 +108,12 @@ static int __maybe_unused catpt_resume(struct device *dev)
static int __maybe_unused catpt_runtime_suspend(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"); dev_info(dev, "module unloading, skipping suspend\n");
return 0; return 0;
} }
module_put(dev->driver->owner);
return catpt_suspend(dev); return catpt_suspend(dev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment