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

Configure Feed

Select the types of activity you want to include in your feed.

mfd: stmfx: Remove #ifdef guards for PM related functions

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Paul Cercueil and committed by
Lee Jones
4d8a6ae2 69bbab91

+2 -6
+2 -4
drivers/mfd/stmfx.c
··· 473 473 stmfx_chip_exit(client); 474 474 } 475 475 476 - #ifdef CONFIG_PM_SLEEP 477 476 static int stmfx_suspend(struct device *dev) 478 477 { 479 478 struct stmfx *stmfx = dev_get_drvdata(dev); ··· 538 539 539 540 return 0; 540 541 } 541 - #endif 542 542 543 - static SIMPLE_DEV_PM_OPS(stmfx_dev_pm_ops, stmfx_suspend, stmfx_resume); 543 + static DEFINE_SIMPLE_DEV_PM_OPS(stmfx_dev_pm_ops, stmfx_suspend, stmfx_resume); 544 544 545 545 static const struct of_device_id stmfx_of_match[] = { 546 546 { .compatible = "st,stmfx-0300", }, ··· 551 553 .driver = { 552 554 .name = "stmfx-core", 553 555 .of_match_table = stmfx_of_match, 554 - .pm = &stmfx_dev_pm_ops, 556 + .pm = pm_sleep_ptr(&stmfx_dev_pm_ops), 555 557 }, 556 558 .probe_new = stmfx_probe, 557 559 .remove = stmfx_remove,
-2
include/linux/mfd/stmfx.h
··· 113 113 struct irq_domain *irq_domain; 114 114 struct mutex lock; /* IRQ bus lock */ 115 115 u8 irq_src; 116 - #ifdef CONFIG_PM 117 116 u8 bkp_sysctrl; 118 117 u8 bkp_irqoutpin; 119 - #endif 120 118 }; 121 119 122 120 int stmfx_function_enable(struct stmfx *stmfx, u32 func);