diff mbox series

[24/36] iio: proximity: cros_ec_mkbp: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

Message ID 20220621202719.13644-25-jic23@kernel.org (mailing list archive)
State Accepted
Headers show
Series IIO: switch easy cases to new simpler PM related macros. | expand

Commit Message

Jonathan Cameron June 21, 2022, 8:27 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: Gwendal Grignou <gwendal@chromium.org>
Cc: Stephen Boyd <swboyd@chromium.org>
---
 drivers/iio/proximity/cros_ec_mkbp_proximity.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Gwendal Grignou June 21, 2022, 9:06 p.m. UTC | #1
On Tue, Jun 21, 2022 at 1:21 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Using these newer macros allows the compiler to remove the unused
> structure and functions when !CONFIG_PM_SLEEP + removes the need to
> mark pm functions __maybe_unused.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> Cc: Gwendal Grignou <gwendal@chromium.org>
> Cc: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
> ---
>  drivers/iio/proximity/cros_ec_mkbp_proximity.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/proximity/cros_ec_mkbp_proximity.c b/drivers/iio/proximity/cros_ec_mkbp_proximity.c
> index 8213b0081713..571ea1812246 100644
> --- a/drivers/iio/proximity/cros_ec_mkbp_proximity.c
> +++ b/drivers/iio/proximity/cros_ec_mkbp_proximity.c
> @@ -184,7 +184,7 @@ static const struct iio_info cros_ec_mkbp_proximity_info = {
>         .write_event_config = cros_ec_mkbp_proximity_write_event_config,
>  };
>
> -static __maybe_unused int cros_ec_mkbp_proximity_resume(struct device *dev)
> +static int cros_ec_mkbp_proximity_resume(struct device *dev)
>  {
>         struct cros_ec_mkbp_proximity_data *data = dev_get_drvdata(dev);
>         struct cros_ec_device *ec = data->ec;
> @@ -201,8 +201,8 @@ static __maybe_unused int cros_ec_mkbp_proximity_resume(struct device *dev)
>         return 0;
>  }
>
> -static SIMPLE_DEV_PM_OPS(cros_ec_mkbp_proximity_pm_ops, NULL,
> -                        cros_ec_mkbp_proximity_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(cros_ec_mkbp_proximity_pm_ops, NULL,
> +                               cros_ec_mkbp_proximity_resume);
>
>  static int cros_ec_mkbp_proximity_probe(struct platform_device *pdev)
>  {
> @@ -260,7 +260,7 @@ static struct platform_driver cros_ec_mkbp_proximity_driver = {
>         .driver = {
>                 .name = "cros-ec-mkbp-proximity",
>                 .of_match_table = cros_ec_mkbp_proximity_of_match,
> -               .pm = &cros_ec_mkbp_proximity_pm_ops,
> +               .pm = pm_sleep_ptr(&cros_ec_mkbp_proximity_pm_ops),
>         },
>         .probe = cros_ec_mkbp_proximity_probe,
>         .remove = cros_ec_mkbp_proximity_remove,
> --
> 2.36.1
>
diff mbox series

Patch

diff --git a/drivers/iio/proximity/cros_ec_mkbp_proximity.c b/drivers/iio/proximity/cros_ec_mkbp_proximity.c
index 8213b0081713..571ea1812246 100644
--- a/drivers/iio/proximity/cros_ec_mkbp_proximity.c
+++ b/drivers/iio/proximity/cros_ec_mkbp_proximity.c
@@ -184,7 +184,7 @@  static const struct iio_info cros_ec_mkbp_proximity_info = {
 	.write_event_config = cros_ec_mkbp_proximity_write_event_config,
 };
 
-static __maybe_unused int cros_ec_mkbp_proximity_resume(struct device *dev)
+static int cros_ec_mkbp_proximity_resume(struct device *dev)
 {
 	struct cros_ec_mkbp_proximity_data *data = dev_get_drvdata(dev);
 	struct cros_ec_device *ec = data->ec;
@@ -201,8 +201,8 @@  static __maybe_unused int cros_ec_mkbp_proximity_resume(struct device *dev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(cros_ec_mkbp_proximity_pm_ops, NULL,
-			 cros_ec_mkbp_proximity_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(cros_ec_mkbp_proximity_pm_ops, NULL,
+				cros_ec_mkbp_proximity_resume);
 
 static int cros_ec_mkbp_proximity_probe(struct platform_device *pdev)
 {
@@ -260,7 +260,7 @@  static struct platform_driver cros_ec_mkbp_proximity_driver = {
 	.driver = {
 		.name = "cros-ec-mkbp-proximity",
 		.of_match_table = cros_ec_mkbp_proximity_of_match,
-		.pm = &cros_ec_mkbp_proximity_pm_ops,
+		.pm = pm_sleep_ptr(&cros_ec_mkbp_proximity_pm_ops),
 	},
 	.probe = cros_ec_mkbp_proximity_probe,
 	.remove = cros_ec_mkbp_proximity_remove,