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

usb/misc: usb3503: 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-8-paul@crapouillou.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Paul Cercueil and committed by
Greg Kroah-Hartman
879a4a66 7aea2a7d

+8 -10
+8 -10
drivers/usb/misc/usb3503.c
··· 322 322 return 0; 323 323 } 324 324 325 - #ifdef CONFIG_PM_SLEEP 326 - static int usb3503_suspend(struct usb3503 *hub) 325 + static int __maybe_unused usb3503_suspend(struct usb3503 *hub) 327 326 { 328 327 usb3503_switch_mode(hub, USB3503_MODE_STANDBY); 329 328 clk_disable_unprepare(hub->clk); ··· 330 331 return 0; 331 332 } 332 333 333 - static int usb3503_resume(struct usb3503 *hub) 334 + static int __maybe_unused usb3503_resume(struct usb3503 *hub) 334 335 { 335 336 clk_prepare_enable(hub->clk); 336 337 usb3503_switch_mode(hub, hub->mode); ··· 338 339 return 0; 339 340 } 340 341 341 - static int usb3503_i2c_suspend(struct device *dev) 342 + static int __maybe_unused usb3503_i2c_suspend(struct device *dev) 342 343 { 343 344 struct i2c_client *client = to_i2c_client(dev); 344 345 345 346 return usb3503_suspend(i2c_get_clientdata(client)); 346 347 } 347 348 348 - static int usb3503_i2c_resume(struct device *dev) 349 + static int __maybe_unused usb3503_i2c_resume(struct device *dev) 349 350 { 350 351 struct i2c_client *client = to_i2c_client(dev); 351 352 352 353 return usb3503_resume(i2c_get_clientdata(client)); 353 354 } 354 355 355 - static int usb3503_platform_suspend(struct device *dev) 356 + static int __maybe_unused usb3503_platform_suspend(struct device *dev) 356 357 { 357 358 return usb3503_suspend(dev_get_drvdata(dev)); 358 359 } 359 360 360 - static int usb3503_platform_resume(struct device *dev) 361 + static int __maybe_unused usb3503_platform_resume(struct device *dev) 361 362 { 362 363 return usb3503_resume(dev_get_drvdata(dev)); 363 364 } 364 - #endif 365 365 366 366 static SIMPLE_DEV_PM_OPS(usb3503_i2c_pm_ops, usb3503_i2c_suspend, 367 367 usb3503_i2c_resume); ··· 386 388 static struct i2c_driver usb3503_i2c_driver = { 387 389 .driver = { 388 390 .name = USB3503_I2C_NAME, 389 - .pm = &usb3503_i2c_pm_ops, 391 + .pm = pm_ptr(&usb3503_i2c_pm_ops), 390 392 .of_match_table = of_match_ptr(usb3503_of_match), 391 393 }, 392 394 .probe = usb3503_i2c_probe, ··· 398 400 .driver = { 399 401 .name = USB3503_I2C_NAME, 400 402 .of_match_table = of_match_ptr(usb3503_of_match), 401 - .pm = &usb3503_platform_pm_ops, 403 + .pm = pm_ptr(&usb3503_platform_pm_ops), 402 404 }, 403 405 .probe = usb3503_platform_probe, 404 406 .remove = usb3503_platform_remove,