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

ahci: st: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based kernel configuration guards.

Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Link: https://lore.kernel.org/r/20250109175427.64384-1-rgallaispou@gmail.com
Signed-off-by: Niklas Cassel <cassel@kernel.org>

authored by

Raphael Gallais-Pou and committed by
Niklas Cassel
f2809aa4 c9b5be90

+2 -4
+2 -4
drivers/ata/ahci_st.c
··· 176 176 return 0; 177 177 } 178 178 179 - #ifdef CONFIG_PM_SLEEP 180 179 static int st_ahci_suspend(struct device *dev) 181 180 { 182 181 struct ata_host *host = dev_get_drvdata(dev); ··· 220 221 221 222 return ahci_platform_resume_host(dev); 222 223 } 223 - #endif 224 224 225 - static SIMPLE_DEV_PM_OPS(st_ahci_pm_ops, st_ahci_suspend, st_ahci_resume); 225 + static DEFINE_SIMPLE_DEV_PM_OPS(st_ahci_pm_ops, st_ahci_suspend, st_ahci_resume); 226 226 227 227 static const struct of_device_id st_ahci_match[] = { 228 228 { .compatible = "st,ahci", }, ··· 232 234 static struct platform_driver st_ahci_driver = { 233 235 .driver = { 234 236 .name = DRV_NAME, 235 - .pm = &st_ahci_pm_ops, 237 + .pm = pm_sleep_ptr(&st_ahci_pm_ops), 236 238 .of_match_table = st_ahci_match, 237 239 }, 238 240 .probe = st_ahci_probe,