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

Input: ti_am335x_tsc - use SIMPLE_DEV_PM_OPS

Instead of doing the dance with macro that either resolves to a pointer or
NULL, let's switch to using SIMPLE_DEV_PM_OPS().

Also let's mark suspend and resume methods as __maybe_unused instead of
guarding them with an #ifdef and rely on linker to drop unused code. Doing
so should allow better compile coverage.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+4 -12
+4 -12
drivers/input/touchscreen/ti_am335x_tsc.c
··· 487 487 return 0; 488 488 } 489 489 490 - #ifdef CONFIG_PM 491 - static int titsc_suspend(struct device *dev) 490 + static int __maybe_unused titsc_suspend(struct device *dev) 492 491 { 493 492 struct titsc *ts_dev = dev_get_drvdata(dev); 494 493 struct ti_tscadc_dev *tscadc_dev; ··· 503 504 return 0; 504 505 } 505 506 506 - static int titsc_resume(struct device *dev) 507 + static int __maybe_unused titsc_resume(struct device *dev) 507 508 { 508 509 struct titsc *ts_dev = dev_get_drvdata(dev); 509 510 struct ti_tscadc_dev *tscadc_dev; ··· 520 521 return 0; 521 522 } 522 523 523 - static const struct dev_pm_ops titsc_pm_ops = { 524 - .suspend = titsc_suspend, 525 - .resume = titsc_resume, 526 - }; 527 - #define TITSC_PM_OPS (&titsc_pm_ops) 528 - #else 529 - #define TITSC_PM_OPS NULL 530 - #endif 524 + static SIMPLE_DEV_PM_OPS(titsc_pm_ops, titsc_suspend, titsc_resume); 531 525 532 526 static const struct of_device_id ti_tsc_dt_ids[] = { 533 527 { .compatible = "ti,am3359-tsc", }, ··· 533 541 .remove = titsc_remove, 534 542 .driver = { 535 543 .name = "TI-am335x-tsc", 536 - .pm = TITSC_PM_OPS, 544 + .pm = &titsc_pm_ops, 537 545 .of_match_table = ti_tsc_dt_ids, 538 546 }, 539 547 };