Skip to content

Commit

Permalink
ASoC: Intel: catpt: Fix compilation when CONFIG_MODULES is disabled
Browse files Browse the repository at this point in the history
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: 7a10b66 ("ASoC: Intel: catpt: Device driver lifecycle")
Reported-by: Randy Dunlap <[email protected]>
Signed-off-by: Cezary Rojewski <[email protected]>
Acked-by: Randy Dunlap <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
crojewsk-intel authored and broonie committed Oct 8, 2020
1 parent 6db282c commit f38d43d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sound/soc/intel/catpt/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}

Expand Down

0 comments on commit f38d43d

Please sign in to comment.