Skip to content

Commit 452fcd2

Browse files
jic23dtor
authored andcommitted
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 <[email protected]> Cc: Matthias Schiffer <[email protected]> Cc: Lyude Paul <[email protected]> Cc: Andrew Duggan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent e2eaf9e commit 452fcd2

File tree

3 files changed

+13
-24
lines changed

3 files changed

+13
-24
lines changed

drivers/input/rmi4/rmi_i2c.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ static int rmi_i2c_probe(struct i2c_client *client)
287287
return 0;
288288
}
289289

290-
#ifdef CONFIG_PM_SLEEP
291290
static int rmi_i2c_suspend(struct device *dev)
292291
{
293292
struct i2c_client *client = to_i2c_client(dev);
@@ -323,9 +322,7 @@ static int rmi_i2c_resume(struct device *dev)
323322

324323
return ret;
325324
}
326-
#endif
327325

328-
#ifdef CONFIG_PM
329326
static int rmi_i2c_runtime_suspend(struct device *dev)
330327
{
331328
struct i2c_client *client = to_i2c_client(dev);
@@ -361,12 +358,10 @@ static int rmi_i2c_runtime_resume(struct device *dev)
361358

362359
return 0;
363360
}
364-
#endif
365361

366362
static const struct dev_pm_ops rmi_i2c_pm = {
367-
SET_SYSTEM_SLEEP_PM_OPS(rmi_i2c_suspend, rmi_i2c_resume)
368-
SET_RUNTIME_PM_OPS(rmi_i2c_runtime_suspend, rmi_i2c_runtime_resume,
369-
NULL)
363+
SYSTEM_SLEEP_PM_OPS(rmi_i2c_suspend, rmi_i2c_resume)
364+
RUNTIME_PM_OPS(rmi_i2c_runtime_suspend, rmi_i2c_runtime_resume, NULL)
370365
};
371366

372367
static const struct i2c_device_id rmi_id[] = {
@@ -378,7 +373,7 @@ MODULE_DEVICE_TABLE(i2c, rmi_id);
378373
static struct i2c_driver rmi_i2c_driver = {
379374
.driver = {
380375
.name = "rmi4_i2c",
381-
.pm = &rmi_i2c_pm,
376+
.pm = pm_ptr(&rmi_i2c_pm),
382377
.of_match_table = of_match_ptr(rmi_i2c_of_match),
383378
},
384379
.id_table = rmi_id,

drivers/input/rmi4/rmi_smbus.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ static void rmi_smb_remove(struct i2c_client *client)
344344
rmi_unregister_transport_device(&rmi_smb->xport);
345345
}
346346

347-
static int __maybe_unused rmi_smb_suspend(struct device *dev)
347+
static int rmi_smb_suspend(struct device *dev)
348348
{
349349
struct i2c_client *client = to_i2c_client(dev);
350350
struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client);
@@ -357,7 +357,7 @@ static int __maybe_unused rmi_smb_suspend(struct device *dev)
357357
return ret;
358358
}
359359

360-
static int __maybe_unused rmi_smb_runtime_suspend(struct device *dev)
360+
static int rmi_smb_runtime_suspend(struct device *dev)
361361
{
362362
struct i2c_client *client = to_i2c_client(dev);
363363
struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client);
@@ -370,7 +370,7 @@ static int __maybe_unused rmi_smb_runtime_suspend(struct device *dev)
370370
return ret;
371371
}
372372

373-
static int __maybe_unused rmi_smb_resume(struct device *dev)
373+
static int rmi_smb_resume(struct device *dev)
374374
{
375375
struct i2c_client *client = container_of(dev, struct i2c_client, dev);
376376
struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client);
@@ -388,7 +388,7 @@ static int __maybe_unused rmi_smb_resume(struct device *dev)
388388
return 0;
389389
}
390390

391-
static int __maybe_unused rmi_smb_runtime_resume(struct device *dev)
391+
static int rmi_smb_runtime_resume(struct device *dev)
392392
{
393393
struct i2c_client *client = to_i2c_client(dev);
394394
struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client);
@@ -402,9 +402,8 @@ static int __maybe_unused rmi_smb_runtime_resume(struct device *dev)
402402
}
403403

404404
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)
408407
};
409408

410409
static const struct i2c_device_id rmi_id[] = {
@@ -416,7 +415,7 @@ MODULE_DEVICE_TABLE(i2c, rmi_id);
416415
static struct i2c_driver rmi_smb_driver = {
417416
.driver = {
418417
.name = "rmi4_smbus",
419-
.pm = &rmi_smb_pm,
418+
.pm = pm_ptr(&rmi_smb_pm),
420419
},
421420
.id_table = rmi_id,
422421
.probe_new = rmi_smb_probe,

drivers/input/rmi4/rmi_spi.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,6 @@ static int rmi_spi_probe(struct spi_device *spi)
447447
return 0;
448448
}
449449

450-
#ifdef CONFIG_PM_SLEEP
451450
static int rmi_spi_suspend(struct device *dev)
452451
{
453452
struct spi_device *spi = to_spi_device(dev);
@@ -473,9 +472,7 @@ static int rmi_spi_resume(struct device *dev)
473472

474473
return ret;
475474
}
476-
#endif
477475

478-
#ifdef CONFIG_PM
479476
static int rmi_spi_runtime_suspend(struct device *dev)
480477
{
481478
struct spi_device *spi = to_spi_device(dev);
@@ -501,12 +498,10 @@ static int rmi_spi_runtime_resume(struct device *dev)
501498

502499
return 0;
503500
}
504-
#endif
505501

506502
static const struct dev_pm_ops rmi_spi_pm = {
507-
SET_SYSTEM_SLEEP_PM_OPS(rmi_spi_suspend, rmi_spi_resume)
508-
SET_RUNTIME_PM_OPS(rmi_spi_runtime_suspend, rmi_spi_runtime_resume,
509-
NULL)
503+
SYSTEM_SLEEP_PM_OPS(rmi_spi_suspend, rmi_spi_resume)
504+
RUNTIME_PM_OPS(rmi_spi_runtime_suspend, rmi_spi_runtime_resume, NULL)
510505
};
511506

512507
static const struct spi_device_id rmi_id[] = {
@@ -518,7 +513,7 @@ MODULE_DEVICE_TABLE(spi, rmi_id);
518513
static struct spi_driver rmi_spi_driver = {
519514
.driver = {
520515
.name = "rmi4_spi",
521-
.pm = &rmi_spi_pm,
516+
.pm = pm_ptr(&rmi_spi_pm),
522517
.of_match_table = of_match_ptr(rmi_spi_of_match),
523518
},
524519
.id_table = rmi_id,

0 commit comments

Comments
 (0)