Skip to content

Commit f2809aa

Browse files
GallaisPoutinefloatious
authored andcommitted
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 <[email protected]> Reviewed-by: Niklas Cassel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Niklas Cassel <[email protected]>
1 parent c9b5be9 commit f2809aa

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/ata/ahci_st.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ static int st_ahci_probe(struct platform_device *pdev)
176176
return 0;
177177
}
178178

179-
#ifdef CONFIG_PM_SLEEP
180179
static int st_ahci_suspend(struct device *dev)
181180
{
182181
struct ata_host *host = dev_get_drvdata(dev);
@@ -221,9 +220,8 @@ static int st_ahci_resume(struct device *dev)
221220

222221
return ahci_platform_resume_host(dev);
223222
}
224-
#endif
225223

226-
static SIMPLE_DEV_PM_OPS(st_ahci_pm_ops, st_ahci_suspend, st_ahci_resume);
224+
static DEFINE_SIMPLE_DEV_PM_OPS(st_ahci_pm_ops, st_ahci_suspend, st_ahci_resume);
227225

228226
static const struct of_device_id st_ahci_match[] = {
229227
{ .compatible = "st,ahci", },
@@ -234,7 +232,7 @@ MODULE_DEVICE_TABLE(of, st_ahci_match);
234232
static struct platform_driver st_ahci_driver = {
235233
.driver = {
236234
.name = DRV_NAME,
237-
.pm = &st_ahci_pm_ops,
235+
.pm = pm_sleep_ptr(&st_ahci_pm_ops),
238236
.of_match_table = st_ahci_match,
239237
},
240238
.probe = st_ahci_probe,

0 commit comments

Comments
 (0)