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: wm8994: Remove #ifdef guards for PM related functions

Use the new RUNTIME_PM_OPS() and pm_ptr() macros to handle the
.runtime_suspend/.runtime_resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_PM 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.

Note that this driver should probably use the new
DEFINE_RUNTIME_DEV_PM_OPS() macro instead, which will provide
.suspend/.resume callbacks, pointing to pm_runtime_force_suspend() and
pm_runtime_force_resume() respectively; unless those callbacks really
aren't needed.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Paul Cercueil and committed by
Lee Jones
9dd3baec d115e88c

+2 -4
+2 -4
drivers/mfd/wm8994-core.c
··· 110 110 "SPKVDD2", 111 111 }; 112 112 113 - #ifdef CONFIG_PM 114 113 static int wm8994_suspend(struct device *dev) 115 114 { 116 115 struct wm8994 *wm8994 = dev_get_drvdata(dev); ··· 212 213 213 214 return ret; 214 215 } 215 - #endif 216 216 217 217 #ifdef CONFIG_REGULATOR 218 218 static int wm8994_ldo_in_use(struct wm8994_pdata *pdata, int ldo) ··· 672 674 MODULE_DEVICE_TABLE(i2c, wm8994_i2c_id); 673 675 674 676 static const struct dev_pm_ops wm8994_pm_ops = { 675 - SET_RUNTIME_PM_OPS(wm8994_suspend, wm8994_resume, NULL) 677 + RUNTIME_PM_OPS(wm8994_suspend, wm8994_resume, NULL) 676 678 }; 677 679 678 680 static struct i2c_driver wm8994_i2c_driver = { 679 681 .driver = { 680 682 .name = "wm8994", 681 - .pm = &wm8994_pm_ops, 683 + .pm = pm_ptr(&wm8994_pm_ops), 682 684 .of_match_table = wm8994_of_match, 683 685 }, 684 686 .probe_new = wm8994_i2c_probe,