diff mbox series

[04/16] Input: s6sy761 - switch to SYSTEM_SLEEP_/RUNTIME_PM_OPS() and pm_ptr()

Message ID 20230114171620.42891-5-jic23@kernel.org (mailing list archive)
State Mainlined
Commit e2eaf9e0e10c8ce2b2740a89d1fab0649345e353
Headers show
Series Input: Switch to new PM macros set 3 | expand

Commit Message

Jonathan Cameron Jan. 14, 2023, 5:16 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

SET_SYSTEM_SLEEP_PM_OPS() and SET_RUNTIME_PM_OPS() are deprecated as
they require 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 __maybe_unused markings.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Caleb Connolly <caleb@connolly.tech>
Cc: Andi Shyti <andi@etezian.org>
---
 drivers/input/touchscreen/s6sy761.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

Comments

Caleb Connolly Jan. 16, 2023, 2:20 p.m. UTC | #1
On 14/01/2023 17:16, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> SET_SYSTEM_SLEEP_PM_OPS() and SET_RUNTIME_PM_OPS() are deprecated as
> they require 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 __maybe_unused markings.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Tested-by: Caleb Connolly <caleb@connolly.tech> # oneplus-guacamole
> Cc: Caleb Connolly <caleb@connolly.tech>
> Cc: Andi Shyti <andi@etezian.org>
> ---
>  drivers/input/touchscreen/s6sy761.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/input/touchscreen/s6sy761.c b/drivers/input/touchscreen/s6sy761.c
> index cc417c03aaca..371cf4848ad5 100644
> --- a/drivers/input/touchscreen/s6sy761.c
> +++ b/drivers/input/touchscreen/s6sy761.c
> @@ -479,7 +479,7 @@ static void s6sy761_remove(struct i2c_client *client)
>  	pm_runtime_disable(&client->dev);
>  }
>
> -static int __maybe_unused s6sy761_runtime_suspend(struct device *dev)
> +static int s6sy761_runtime_suspend(struct device *dev)
>  {
>  	struct s6sy761_data *sdata = dev_get_drvdata(dev);
>
> @@ -487,7 +487,7 @@ static int __maybe_unused s6sy761_runtime_suspend(struct device *dev)
>  				S6SY761_APPLICATION_MODE, S6SY761_APP_SLEEP);
>  }
>
> -static int __maybe_unused s6sy761_runtime_resume(struct device *dev)
> +static int s6sy761_runtime_resume(struct device *dev)
>  {
>  	struct s6sy761_data *sdata = dev_get_drvdata(dev);
>
> @@ -495,7 +495,7 @@ static int __maybe_unused s6sy761_runtime_resume(struct device *dev)
>  				S6SY761_APPLICATION_MODE, S6SY761_APP_NORMAL);
>  }
>
> -static int __maybe_unused s6sy761_suspend(struct device *dev)
> +static int s6sy761_suspend(struct device *dev)
>  {
>  	struct s6sy761_data *sdata = dev_get_drvdata(dev);
>
> @@ -504,7 +504,7 @@ static int __maybe_unused s6sy761_suspend(struct device *dev)
>  	return 0;
>  }
>
> -static int __maybe_unused s6sy761_resume(struct device *dev)
> +static int s6sy761_resume(struct device *dev)
>  {
>  	struct s6sy761_data *sdata = dev_get_drvdata(dev);
>
> @@ -514,9 +514,8 @@ static int __maybe_unused s6sy761_resume(struct device *dev)
>  }
>
>  static const struct dev_pm_ops s6sy761_pm_ops = {
> -	SET_SYSTEM_SLEEP_PM_OPS(s6sy761_suspend, s6sy761_resume)
> -	SET_RUNTIME_PM_OPS(s6sy761_runtime_suspend,
> -				s6sy761_runtime_resume, NULL)
> +	SYSTEM_SLEEP_PM_OPS(s6sy761_suspend, s6sy761_resume)
> +	RUNTIME_PM_OPS(s6sy761_runtime_suspend, s6sy761_runtime_resume, NULL)
>  };
>
>  #ifdef CONFIG_OF
> @@ -537,7 +536,7 @@ static struct i2c_driver s6sy761_driver = {
>  	.driver = {
>  		.name = S6SY761_DEV_NAME,
>  		.of_match_table = of_match_ptr(s6sy761_of_match),
> -		.pm = &s6sy761_pm_ops,
> +		.pm = pm_ptr(&s6sy761_pm_ops),
>  	},
>  	.probe_new = s6sy761_probe,
>  	.remove = s6sy761_remove,
> --
> 2.39.0
>

--
Kind Regards,
Caleb
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/s6sy761.c b/drivers/input/touchscreen/s6sy761.c
index cc417c03aaca..371cf4848ad5 100644
--- a/drivers/input/touchscreen/s6sy761.c
+++ b/drivers/input/touchscreen/s6sy761.c
@@ -479,7 +479,7 @@  static void s6sy761_remove(struct i2c_client *client)
 	pm_runtime_disable(&client->dev);
 }
 
-static int __maybe_unused s6sy761_runtime_suspend(struct device *dev)
+static int s6sy761_runtime_suspend(struct device *dev)
 {
 	struct s6sy761_data *sdata = dev_get_drvdata(dev);
 
@@ -487,7 +487,7 @@  static int __maybe_unused s6sy761_runtime_suspend(struct device *dev)
 				S6SY761_APPLICATION_MODE, S6SY761_APP_SLEEP);
 }
 
-static int __maybe_unused s6sy761_runtime_resume(struct device *dev)
+static int s6sy761_runtime_resume(struct device *dev)
 {
 	struct s6sy761_data *sdata = dev_get_drvdata(dev);
 
@@ -495,7 +495,7 @@  static int __maybe_unused s6sy761_runtime_resume(struct device *dev)
 				S6SY761_APPLICATION_MODE, S6SY761_APP_NORMAL);
 }
 
-static int __maybe_unused s6sy761_suspend(struct device *dev)
+static int s6sy761_suspend(struct device *dev)
 {
 	struct s6sy761_data *sdata = dev_get_drvdata(dev);
 
@@ -504,7 +504,7 @@  static int __maybe_unused s6sy761_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused s6sy761_resume(struct device *dev)
+static int s6sy761_resume(struct device *dev)
 {
 	struct s6sy761_data *sdata = dev_get_drvdata(dev);
 
@@ -514,9 +514,8 @@  static int __maybe_unused s6sy761_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops s6sy761_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(s6sy761_suspend, s6sy761_resume)
-	SET_RUNTIME_PM_OPS(s6sy761_runtime_suspend,
-				s6sy761_runtime_resume, NULL)
+	SYSTEM_SLEEP_PM_OPS(s6sy761_suspend, s6sy761_resume)
+	RUNTIME_PM_OPS(s6sy761_runtime_suspend, s6sy761_runtime_resume, NULL)
 };
 
 #ifdef CONFIG_OF
@@ -537,7 +536,7 @@  static struct i2c_driver s6sy761_driver = {
 	.driver = {
 		.name = S6SY761_DEV_NAME,
 		.of_match_table = of_match_ptr(s6sy761_of_match),
-		.pm = &s6sy761_pm_ops,
+		.pm = pm_ptr(&s6sy761_pm_ops),
 	},
 	.probe_new = s6sy761_probe,
 	.remove = s6sy761_remove,