diff mbox series

[10/32] Input: qt1050 - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

Message ID 20221204180841.2211588-11-jic23@kernel.org
State New
Headers show
Series Input: Joystick keyboard switch to DEFINE_SIMPLE_DEV_PM_OPS() | expand

Commit Message

Jonathan Cameron Dec. 4, 2022, 6:08 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

SIMPLE_DEV_PM_OPS() is deprecated as it requires explicit protection
against unused function warnings.  The new combination of pm_sleep_ptr()
and DEFINE_SIMPLE_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 __maybe_unused markings.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Marco Felsch <m.felsch@pengutronix.de>
---
 drivers/input/keyboard/qt1050.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Marco Felsch Dec. 5, 2022, 8:59 a.m. UTC | #1
Hi Jonathan,

thanks for the patch.

On 22-12-04, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> SIMPLE_DEV_PM_OPS() is deprecated as it requires explicit protection
> against unused function warnings.  The new combination of pm_sleep_ptr()
> and DEFINE_SIMPLE_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 __maybe_unused markings.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>

> Cc: Marco Felsch <m.felsch@pengutronix.de>
> ---
>  drivers/input/keyboard/qt1050.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/keyboard/qt1050.c b/drivers/input/keyboard/qt1050.c
> index 403060d05c3b..317fe2b1f827 100644
> --- a/drivers/input/keyboard/qt1050.c
> +++ b/drivers/input/keyboard/qt1050.c
> @@ -547,7 +547,7 @@ static int qt1050_probe(struct i2c_client *client)
>  	return 0;
>  }
>  
> -static int __maybe_unused qt1050_suspend(struct device *dev)
> +static int qt1050_suspend(struct device *dev)
>  {
>  	struct i2c_client *client = to_i2c_client(dev);
>  	struct qt1050_priv *ts = i2c_get_clientdata(client);
> @@ -563,7 +563,7 @@ static int __maybe_unused qt1050_suspend(struct device *dev)
>  			    device_may_wakeup(dev) ? 125 : 0);
>  }
>  
> -static int __maybe_unused qt1050_resume(struct device *dev)
> +static int qt1050_resume(struct device *dev)
>  {
>  	struct i2c_client *client = to_i2c_client(dev);
>  	struct qt1050_priv *ts = i2c_get_clientdata(client);
> @@ -574,7 +574,7 @@ static int __maybe_unused qt1050_resume(struct device *dev)
>  	return regmap_write(ts->regmap, QT1050_LPMODE, 2);
>  }
>  
> -static SIMPLE_DEV_PM_OPS(qt1050_pm_ops, qt1050_suspend, qt1050_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(qt1050_pm_ops, qt1050_suspend, qt1050_resume);
>  
>  static const struct of_device_id __maybe_unused qt1050_of_match[] = {
>  	{ .compatible = "microchip,qt1050", },
> @@ -586,7 +586,7 @@ static struct i2c_driver qt1050_driver = {
>  	.driver	= {
>  		.name = "qt1050",
>  		.of_match_table = of_match_ptr(qt1050_of_match),
> -		.pm = &qt1050_pm_ops,
> +		.pm = pm_sleep_ptr(&qt1050_pm_ops),
>  	},
>  	.probe_new = qt1050_probe,
>  };
> -- 
> 2.38.1
> 
>
diff mbox series

Patch

diff --git a/drivers/input/keyboard/qt1050.c b/drivers/input/keyboard/qt1050.c
index 403060d05c3b..317fe2b1f827 100644
--- a/drivers/input/keyboard/qt1050.c
+++ b/drivers/input/keyboard/qt1050.c
@@ -547,7 +547,7 @@  static int qt1050_probe(struct i2c_client *client)
 	return 0;
 }
 
-static int __maybe_unused qt1050_suspend(struct device *dev)
+static int qt1050_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct qt1050_priv *ts = i2c_get_clientdata(client);
@@ -563,7 +563,7 @@  static int __maybe_unused qt1050_suspend(struct device *dev)
 			    device_may_wakeup(dev) ? 125 : 0);
 }
 
-static int __maybe_unused qt1050_resume(struct device *dev)
+static int qt1050_resume(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct qt1050_priv *ts = i2c_get_clientdata(client);
@@ -574,7 +574,7 @@  static int __maybe_unused qt1050_resume(struct device *dev)
 	return regmap_write(ts->regmap, QT1050_LPMODE, 2);
 }
 
-static SIMPLE_DEV_PM_OPS(qt1050_pm_ops, qt1050_suspend, qt1050_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(qt1050_pm_ops, qt1050_suspend, qt1050_resume);
 
 static const struct of_device_id __maybe_unused qt1050_of_match[] = {
 	{ .compatible = "microchip,qt1050", },
@@ -586,7 +586,7 @@  static struct i2c_driver qt1050_driver = {
 	.driver	= {
 		.name = "qt1050",
 		.of_match_table = of_match_ptr(qt1050_of_match),
-		.pm = &qt1050_pm_ops,
+		.pm = pm_sleep_ptr(&qt1050_pm_ops),
 	},
 	.probe_new = qt1050_probe,
 };