Skip to content

Commit ebbdbef

Browse files
jic23dtor
authored andcommitted
Input: cyttsp4 - use EXPORT_GPL_RUNTIME_DEV_PM_OPS()
SET_SYSTEM_SLEEP_PM_OPS() and RUNTIME_PM_OPS() are deprecated as they requires explicit protection against unused function warnings. The new combination of pm_ptr() EXPORT_GPL_RUNTIME_DEV_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. Note that we are replacing an unconditional call to the suspend and resume functions for sleep use cases with one via pm_runtime_force_suspend() / pm_runtime_force_resume() that only do anything to the device if we are not already in the appropriate runtime suspended state. Signed-off-by: Jonathan Cameron <[email protected]> -- I 'think' this should be fine in that it can only reduce the number of unnecessary suspends. If anyone can test that would be great. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 6470215 commit ebbdbef

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

drivers/input/touchscreen/cyttsp4_core.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,7 +1744,6 @@ static void cyttsp4_free_si_ptrs(struct cyttsp4 *cd)
17441744
kfree(si->btn_rec_data);
17451745
}
17461746

1747-
#ifdef CONFIG_PM
17481747
static int cyttsp4_core_sleep(struct cyttsp4 *cd)
17491748
{
17501749
int rc;
@@ -1877,13 +1876,9 @@ static int cyttsp4_core_resume(struct device *dev)
18771876

18781877
return 0;
18791878
}
1880-
#endif
18811879

1882-
const struct dev_pm_ops cyttsp4_pm_ops = {
1883-
SET_SYSTEM_SLEEP_PM_OPS(cyttsp4_core_suspend, cyttsp4_core_resume)
1884-
SET_RUNTIME_PM_OPS(cyttsp4_core_suspend, cyttsp4_core_resume, NULL)
1885-
};
1886-
EXPORT_SYMBOL_GPL(cyttsp4_pm_ops);
1880+
EXPORT_GPL_RUNTIME_DEV_PM_OPS(cyttsp4_pm_ops,
1881+
cyttsp4_core_suspend, cyttsp4_core_resume, NULL);
18871882

18881883
static int cyttsp4_mt_open(struct input_dev *input)
18891884
{

drivers/input/touchscreen/cyttsp4_i2c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ MODULE_DEVICE_TABLE(i2c, cyttsp4_i2c_id);
5858
static struct i2c_driver cyttsp4_i2c_driver = {
5959
.driver = {
6060
.name = CYTTSP4_I2C_NAME,
61-
.pm = &cyttsp4_pm_ops,
61+
.pm = pm_ptr(&cyttsp4_pm_ops),
6262
},
6363
.probe_new = cyttsp4_i2c_probe,
6464
.remove = cyttsp4_i2c_remove,

drivers/input/touchscreen/cyttsp4_spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static void cyttsp4_spi_remove(struct spi_device *spi)
173173
static struct spi_driver cyttsp4_spi_driver = {
174174
.driver = {
175175
.name = CYTTSP4_SPI_NAME,
176-
.pm = &cyttsp4_pm_ops,
176+
.pm = pm_ptr(&cyttsp4_pm_ops),
177177
},
178178
.probe = cyttsp4_spi_probe,
179179
.remove = cyttsp4_spi_remove,

0 commit comments

Comments
 (0)