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.

Input: rmi4 - switch to SYSTEM_SLEEP/RUNTIME_PM_OPS() and pm_ptr()

SET_SYSTEM_SLEEP_PM_OPS() and SET_RUNTIME_PM_OPS() are deprecated
as they requires explicit protection against unused function warnings.
The new combination of pm_ptr() and SYSTEM_SLEEP_PM_OPS() /
RUNTIME_PM_OPS() allows the compiler to see the functions,
thus suppressing the warning, but still allowing the unused code to
be removed. Thus also drop the #ifdef guards.

Whilst all 3 sets of callbacks are similar, there are small differences
that make it challenging to use a single pm_dev_ops structure - hence
leave the duplication as it stands.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: Andrew Duggan <aduggan@synaptics.com>
Link: https://lore.kernel.org/r/20230114171620.42891-6-jic23@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Jonathan Cameron and committed by
Dmitry Torokhov
452fcd2d e2eaf9e0

+13 -24
+3 -8
drivers/input/rmi4/rmi_i2c.c
··· 287 287 return 0; 288 288 } 289 289 290 - #ifdef CONFIG_PM_SLEEP 291 290 static int rmi_i2c_suspend(struct device *dev) 292 291 { 293 292 struct i2c_client *client = to_i2c_client(dev); ··· 322 323 323 324 return ret; 324 325 } 325 - #endif 326 326 327 - #ifdef CONFIG_PM 328 327 static int rmi_i2c_runtime_suspend(struct device *dev) 329 328 { 330 329 struct i2c_client *client = to_i2c_client(dev); ··· 358 361 359 362 return 0; 360 363 } 361 - #endif 362 364 363 365 static const struct dev_pm_ops rmi_i2c_pm = { 364 - SET_SYSTEM_SLEEP_PM_OPS(rmi_i2c_suspend, rmi_i2c_resume) 365 - SET_RUNTIME_PM_OPS(rmi_i2c_runtime_suspend, rmi_i2c_runtime_resume, 366 - NULL) 366 + SYSTEM_SLEEP_PM_OPS(rmi_i2c_suspend, rmi_i2c_resume) 367 + RUNTIME_PM_OPS(rmi_i2c_runtime_suspend, rmi_i2c_runtime_resume, NULL) 367 368 }; 368 369 369 370 static const struct i2c_device_id rmi_id[] = { ··· 373 378 static struct i2c_driver rmi_i2c_driver = { 374 379 .driver = { 375 380 .name = "rmi4_i2c", 376 - .pm = &rmi_i2c_pm, 381 + .pm = pm_ptr(&rmi_i2c_pm), 377 382 .of_match_table = of_match_ptr(rmi_i2c_of_match), 378 383 }, 379 384 .id_table = rmi_id,
+7 -8
drivers/input/rmi4/rmi_smbus.c
··· 344 344 rmi_unregister_transport_device(&rmi_smb->xport); 345 345 } 346 346 347 - static int __maybe_unused rmi_smb_suspend(struct device *dev) 347 + static int rmi_smb_suspend(struct device *dev) 348 348 { 349 349 struct i2c_client *client = to_i2c_client(dev); 350 350 struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client); ··· 357 357 return ret; 358 358 } 359 359 360 - static int __maybe_unused rmi_smb_runtime_suspend(struct device *dev) 360 + static int rmi_smb_runtime_suspend(struct device *dev) 361 361 { 362 362 struct i2c_client *client = to_i2c_client(dev); 363 363 struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client); ··· 370 370 return ret; 371 371 } 372 372 373 - static int __maybe_unused rmi_smb_resume(struct device *dev) 373 + static int rmi_smb_resume(struct device *dev) 374 374 { 375 375 struct i2c_client *client = container_of(dev, struct i2c_client, dev); 376 376 struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client); ··· 388 388 return 0; 389 389 } 390 390 391 - static int __maybe_unused rmi_smb_runtime_resume(struct device *dev) 391 + static int rmi_smb_runtime_resume(struct device *dev) 392 392 { 393 393 struct i2c_client *client = to_i2c_client(dev); 394 394 struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client); ··· 402 402 } 403 403 404 404 static const struct dev_pm_ops rmi_smb_pm = { 405 - SET_SYSTEM_SLEEP_PM_OPS(rmi_smb_suspend, rmi_smb_resume) 406 - SET_RUNTIME_PM_OPS(rmi_smb_runtime_suspend, rmi_smb_runtime_resume, 407 - NULL) 405 + SYSTEM_SLEEP_PM_OPS(rmi_smb_suspend, rmi_smb_resume) 406 + RUNTIME_PM_OPS(rmi_smb_runtime_suspend, rmi_smb_runtime_resume, NULL) 408 407 }; 409 408 410 409 static const struct i2c_device_id rmi_id[] = { ··· 415 416 static struct i2c_driver rmi_smb_driver = { 416 417 .driver = { 417 418 .name = "rmi4_smbus", 418 - .pm = &rmi_smb_pm, 419 + .pm = pm_ptr(&rmi_smb_pm), 419 420 }, 420 421 .id_table = rmi_id, 421 422 .probe_new = rmi_smb_probe,
+3 -8
drivers/input/rmi4/rmi_spi.c
··· 447 447 return 0; 448 448 } 449 449 450 - #ifdef CONFIG_PM_SLEEP 451 450 static int rmi_spi_suspend(struct device *dev) 452 451 { 453 452 struct spi_device *spi = to_spi_device(dev); ··· 472 473 473 474 return ret; 474 475 } 475 - #endif 476 476 477 - #ifdef CONFIG_PM 478 477 static int rmi_spi_runtime_suspend(struct device *dev) 479 478 { 480 479 struct spi_device *spi = to_spi_device(dev); ··· 498 501 499 502 return 0; 500 503 } 501 - #endif 502 504 503 505 static const struct dev_pm_ops rmi_spi_pm = { 504 - SET_SYSTEM_SLEEP_PM_OPS(rmi_spi_suspend, rmi_spi_resume) 505 - SET_RUNTIME_PM_OPS(rmi_spi_runtime_suspend, rmi_spi_runtime_resume, 506 - NULL) 506 + SYSTEM_SLEEP_PM_OPS(rmi_spi_suspend, rmi_spi_resume) 507 + RUNTIME_PM_OPS(rmi_spi_runtime_suspend, rmi_spi_runtime_resume, NULL) 507 508 }; 508 509 509 510 static const struct spi_device_id rmi_id[] = { ··· 513 518 static struct spi_driver rmi_spi_driver = { 514 519 .driver = { 515 520 .name = "rmi4_spi", 516 - .pm = &rmi_spi_pm, 521 + .pm = pm_ptr(&rmi_spi_pm), 517 522 .of_match_table = of_match_ptr(rmi_spi_of_match), 518 523 }, 519 524 .id_table = rmi_id,