Commit 452fcd2d authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Dmitry Torokhov

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: default avatarJonathan 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.orgSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent e2eaf9e0
......@@ -287,7 +287,6 @@ static int rmi_i2c_probe(struct i2c_client *client)
return 0;
}
#ifdef CONFIG_PM_SLEEP
static int rmi_i2c_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
......@@ -323,9 +322,7 @@ static int rmi_i2c_resume(struct device *dev)
return ret;
}
#endif
#ifdef CONFIG_PM
static int rmi_i2c_runtime_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
......@@ -361,12 +358,10 @@ static int rmi_i2c_runtime_resume(struct device *dev)
return 0;
}
#endif
static const struct dev_pm_ops rmi_i2c_pm = {
SET_SYSTEM_SLEEP_PM_OPS(rmi_i2c_suspend, rmi_i2c_resume)
SET_RUNTIME_PM_OPS(rmi_i2c_runtime_suspend, rmi_i2c_runtime_resume,
NULL)
SYSTEM_SLEEP_PM_OPS(rmi_i2c_suspend, rmi_i2c_resume)
RUNTIME_PM_OPS(rmi_i2c_runtime_suspend, rmi_i2c_runtime_resume, NULL)
};
static const struct i2c_device_id rmi_id[] = {
......@@ -378,7 +373,7 @@ MODULE_DEVICE_TABLE(i2c, rmi_id);
static struct i2c_driver rmi_i2c_driver = {
.driver = {
.name = "rmi4_i2c",
.pm = &rmi_i2c_pm,
.pm = pm_ptr(&rmi_i2c_pm),
.of_match_table = of_match_ptr(rmi_i2c_of_match),
},
.id_table = rmi_id,
......
......@@ -344,7 +344,7 @@ static void rmi_smb_remove(struct i2c_client *client)
rmi_unregister_transport_device(&rmi_smb->xport);
}
static int __maybe_unused rmi_smb_suspend(struct device *dev)
static int rmi_smb_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client);
......@@ -357,7 +357,7 @@ static int __maybe_unused rmi_smb_suspend(struct device *dev)
return ret;
}
static int __maybe_unused rmi_smb_runtime_suspend(struct device *dev)
static int rmi_smb_runtime_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
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)
return ret;
}
static int __maybe_unused rmi_smb_resume(struct device *dev)
static int rmi_smb_resume(struct device *dev)
{
struct i2c_client *client = container_of(dev, struct i2c_client, dev);
struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client);
......@@ -388,7 +388,7 @@ static int __maybe_unused rmi_smb_resume(struct device *dev)
return 0;
}
static int __maybe_unused rmi_smb_runtime_resume(struct device *dev)
static int rmi_smb_runtime_resume(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
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)
}
static const struct dev_pm_ops rmi_smb_pm = {
SET_SYSTEM_SLEEP_PM_OPS(rmi_smb_suspend, rmi_smb_resume)
SET_RUNTIME_PM_OPS(rmi_smb_runtime_suspend, rmi_smb_runtime_resume,
NULL)
SYSTEM_SLEEP_PM_OPS(rmi_smb_suspend, rmi_smb_resume)
RUNTIME_PM_OPS(rmi_smb_runtime_suspend, rmi_smb_runtime_resume, NULL)
};
static const struct i2c_device_id rmi_id[] = {
......@@ -416,7 +415,7 @@ MODULE_DEVICE_TABLE(i2c, rmi_id);
static struct i2c_driver rmi_smb_driver = {
.driver = {
.name = "rmi4_smbus",
.pm = &rmi_smb_pm,
.pm = pm_ptr(&rmi_smb_pm),
},
.id_table = rmi_id,
.probe_new = rmi_smb_probe,
......
......@@ -447,7 +447,6 @@ static int rmi_spi_probe(struct spi_device *spi)
return 0;
}
#ifdef CONFIG_PM_SLEEP
static int rmi_spi_suspend(struct device *dev)
{
struct spi_device *spi = to_spi_device(dev);
......@@ -473,9 +472,7 @@ static int rmi_spi_resume(struct device *dev)
return ret;
}
#endif
#ifdef CONFIG_PM
static int rmi_spi_runtime_suspend(struct device *dev)
{
struct spi_device *spi = to_spi_device(dev);
......@@ -501,12 +498,10 @@ static int rmi_spi_runtime_resume(struct device *dev)
return 0;
}
#endif
static const struct dev_pm_ops rmi_spi_pm = {
SET_SYSTEM_SLEEP_PM_OPS(rmi_spi_suspend, rmi_spi_resume)
SET_RUNTIME_PM_OPS(rmi_spi_runtime_suspend, rmi_spi_runtime_resume,
NULL)
SYSTEM_SLEEP_PM_OPS(rmi_spi_suspend, rmi_spi_resume)
RUNTIME_PM_OPS(rmi_spi_runtime_suspend, rmi_spi_runtime_resume, NULL)
};
static const struct spi_device_id rmi_id[] = {
......@@ -518,7 +513,7 @@ MODULE_DEVICE_TABLE(spi, rmi_id);
static struct spi_driver rmi_spi_driver = {
.driver = {
.name = "rmi4_spi",
.pm = &rmi_spi_pm,
.pm = pm_ptr(&rmi_spi_pm),
.of_match_table = of_match_ptr(rmi_spi_of_match),
},
.id_table = rmi_id,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment