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

usb/misc: usb4604: Use pm_ptr() macro

Use the newly introduced pm_ptr() macro, and mark the suspend/resume
functions __maybe_unused. These functions can then be moved outside the
CONFIG_PM_SUSPEND block, and the compiler can then process them and
detect build failures independently of the config. If unused, they will
simply be discarded by the compiler.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20200903112554.34263-9-paul@crapouillou.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Paul Cercueil and committed by
Greg Kroah-Hartman
7aea2a7d f2ea828d

+3 -5
+3 -5
drivers/usb/misc/usb4604.c
··· 112 112 return usb4604_probe(hub); 113 113 } 114 114 115 - #ifdef CONFIG_PM_SLEEP 116 - static int usb4604_i2c_suspend(struct device *dev) 115 + static int __maybe_unused usb4604_i2c_suspend(struct device *dev) 117 116 { 118 117 struct i2c_client *client = to_i2c_client(dev); 119 118 struct usb4604 *hub = i2c_get_clientdata(client); ··· 122 123 return 0; 123 124 } 124 125 125 - static int usb4604_i2c_resume(struct device *dev) 126 + static int __maybe_unused usb4604_i2c_resume(struct device *dev) 126 127 { 127 128 struct i2c_client *client = to_i2c_client(dev); 128 129 struct usb4604 *hub = i2c_get_clientdata(client); ··· 131 132 132 133 return 0; 133 134 } 134 - #endif 135 135 136 136 static SIMPLE_DEV_PM_OPS(usb4604_i2c_pm_ops, usb4604_i2c_suspend, 137 137 usb4604_i2c_resume); ··· 152 154 static struct i2c_driver usb4604_i2c_driver = { 153 155 .driver = { 154 156 .name = "usb4604", 155 - .pm = &usb4604_i2c_pm_ops, 157 + .pm = pm_ptr(&usb4604_i2c_pm_ops), 156 158 .of_match_table = of_match_ptr(usb4604_of_match), 157 159 }, 158 160 .probe = usb4604_i2c_probe,