Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tpm/tpm_crb: fix unused warnings on suspend/resume functions

When PM_SLEEP is disabled crb_pm_suspend and crb_pm_resume are not used by
SET_SYSTEM_SLEEP_PM_OPS even if PM is enabled:

drvers/char/tpm/tpm_crb.c:540:12: warning: ‘crb_pm_suspend’ defined but not
used [-Wunused-function]
static int crb_pm_suspend(struct device *dev)
^
drivers/char/tpm/tpm_crb.c:551:12: warning: ‘crb_pm_resume’ defined but not
used [-Wunused-function]
static int crb_pm_resume(struct device *dev)
^

The preprocessor condition should be on CONFIG_PM_SLEEP, not on CONFIG_PM.
However, this patch fixes this warning by using __maybe_unused on function
that are in the preprocessor condition.

Fixes: 848efcfb560c ("tpm/tpm_crb: enter the low power state upon device suspend")
Signed-off-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

authored by

Jérémy Lefaure and committed by
Jarkko Sakkinen
67c2f3d3 0afb7118

+4 -7
+4 -7
drivers/char/tpm/tpm_crb.c
··· 519 519 return 0; 520 520 } 521 521 522 - #ifdef CONFIG_PM 523 - static int crb_pm_runtime_suspend(struct device *dev) 522 + static int __maybe_unused crb_pm_runtime_suspend(struct device *dev) 524 523 { 525 524 struct tpm_chip *chip = dev_get_drvdata(dev); 526 525 struct crb_priv *priv = dev_get_drvdata(&chip->dev); ··· 527 528 return crb_go_idle(dev, priv); 528 529 } 529 530 530 - static int crb_pm_runtime_resume(struct device *dev) 531 + static int __maybe_unused crb_pm_runtime_resume(struct device *dev) 531 532 { 532 533 struct tpm_chip *chip = dev_get_drvdata(dev); 533 534 struct crb_priv *priv = dev_get_drvdata(&chip->dev); ··· 535 536 return crb_cmd_ready(dev, priv); 536 537 } 537 538 538 - static int crb_pm_suspend(struct device *dev) 539 + static int __maybe_unused crb_pm_suspend(struct device *dev) 539 540 { 540 541 int ret; 541 542 ··· 546 547 return crb_pm_runtime_suspend(dev); 547 548 } 548 549 549 - static int crb_pm_resume(struct device *dev) 550 + static int __maybe_unused crb_pm_resume(struct device *dev) 550 551 { 551 552 int ret; 552 553 ··· 556 557 557 558 return tpm_pm_resume(dev); 558 559 } 559 - 560 - #endif /* CONFIG_PM */ 561 560 562 561 static const struct dev_pm_ops crb_pm = { 563 562 SET_SYSTEM_SLEEP_PM_OPS(crb_pm_suspend, crb_pm_resume)