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

mfd: mcp-sa11x0: Remove #ifdef guards for PM related functions

Use the new pm_sleep_ptr() macro to handle the .suspend/.resume
callbacks.

This macro 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
ff84723e fdefee30

+1 -5
+1 -5
drivers/mfd/mcp-sa11x0.c
··· 255 255 return 0; 256 256 } 257 257 258 - #ifdef CONFIG_PM_SLEEP 259 258 static int mcp_sa11x0_suspend(struct device *dev) 260 259 { 261 260 struct mcp_sa11x0 *m = priv(dev_get_drvdata(dev)); ··· 276 277 277 278 return 0; 278 279 } 279 - #endif 280 280 281 281 static const struct dev_pm_ops mcp_sa11x0_pm_ops = { 282 - #ifdef CONFIG_PM_SLEEP 283 282 .suspend = mcp_sa11x0_suspend, 284 283 .freeze = mcp_sa11x0_suspend, 285 284 .poweroff = mcp_sa11x0_suspend, 286 285 .resume_noirq = mcp_sa11x0_resume, 287 286 .thaw_noirq = mcp_sa11x0_resume, 288 287 .restore_noirq = mcp_sa11x0_resume, 289 - #endif 290 288 }; 291 289 292 290 static struct platform_driver mcp_sa11x0_driver = { ··· 291 295 .remove = mcp_sa11x0_remove, 292 296 .driver = { 293 297 .name = DRIVER_NAME, 294 - .pm = &mcp_sa11x0_pm_ops, 298 + .pm = pm_sleep_ptr(&mcp_sa11x0_pm_ops), 295 299 }, 296 300 }; 297 301