ALSA: hda: cix-ipbloq: Use modern PM ops

When building without CONFIG_PM_SLEEP, there are several warnings (or
errors with CONFIG_WERROR=y / W=e) from the cix-ipbloq driver:

  sound/hda/controllers/cix-ipbloq.c:378:12: error: 'cix_ipbloq_hda_runtime_resume' defined but not used [-Werror=unused-function]
    378 | static int cix_ipbloq_hda_runtime_resume(struct device *dev)
        |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  sound/hda/controllers/cix-ipbloq.c:362:12: error: 'cix_ipbloq_hda_runtime_suspend' defined but not used [-Werror=unused-function]
    362 | static int cix_ipbloq_hda_runtime_suspend(struct device *dev)
        |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  sound/hda/controllers/cix-ipbloq.c:349:12: error: 'cix_ipbloq_hda_resume' defined but not used [-Werror=unused-function]
    349 | static int cix_ipbloq_hda_resume(struct device *dev)
        |            ^~~~~~~~~~~~~~~~~~~~~
  sound/hda/controllers/cix-ipbloq.c:336:12: error: 'cix_ipbloq_hda_suspend' defined but not used [-Werror=unused-function]
    336 | static int cix_ipbloq_hda_suspend(struct device *dev)
        |            ^~~~~~~~~~~~~~~~~~~~~~

When CONFIG_PM and CONFIG_PM_SLEEP are unset, SET_SYSTEM_SLEEP_PM_OPS()
and SET_RUNTIME_PM_OPS() evaluate to nothing, so these functions appear
unused to the compiler in this configuration.

Use the modern SYSTEM_SLEEP_PM_OPS and RUNTIME_PM_OPS macros to resolve
these warnings, which is what they are intended to do. Additionally,
wrap &cix_ipbloq_hda_pm in pm_ptr() to ensure the compiler can drop the
entire structure when CONFIG_PM is unset.

Fixes: d91e9bd101 ("ALSA: hda: add CIX IPBLOQ HDA controller support")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Link: https://patch.msgid.link/20251211-hda-cix-ipbloq-modern-pm-ops-v1-1-c7a5580af021@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
pull/1354/merge
Nathan Chancellor 2025-12-11 10:50:03 +09:00 committed by Takashi Iwai
parent b13efb5359
commit e33a6abdb7
1 changed files with 5 additions and 5 deletions

View File

@ -407,9 +407,9 @@ static int cix_ipbloq_hda_runtime_resume(struct device *dev)
} }
static const struct dev_pm_ops cix_ipbloq_hda_pm = { static const struct dev_pm_ops cix_ipbloq_hda_pm = {
SET_SYSTEM_SLEEP_PM_OPS(cix_ipbloq_hda_suspend, SYSTEM_SLEEP_PM_OPS(cix_ipbloq_hda_suspend,
cix_ipbloq_hda_resume) cix_ipbloq_hda_resume)
SET_RUNTIME_PM_OPS(cix_ipbloq_hda_runtime_suspend, RUNTIME_PM_OPS(cix_ipbloq_hda_runtime_suspend,
cix_ipbloq_hda_runtime_resume, NULL) cix_ipbloq_hda_runtime_resume, NULL)
}; };
@ -422,7 +422,7 @@ MODULE_DEVICE_TABLE(of, cix_ipbloq_hda_match);
static struct platform_driver cix_ipbloq_hda_driver = { static struct platform_driver cix_ipbloq_hda_driver = {
.driver = { .driver = {
.name = "cix-ipbloq-hda", .name = "cix-ipbloq-hda",
.pm = &cix_ipbloq_hda_pm, .pm = pm_ptr(&cix_ipbloq_hda_pm),
.of_match_table = cix_ipbloq_hda_match, .of_match_table = cix_ipbloq_hda_match,
}, },
.probe = cix_ipbloq_hda_probe, .probe = cix_ipbloq_hda_probe,