2023-07-05 21:10:04

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 03/23] i2c: iproc: Remove #ifdef guards for PM related functions

Use the new PM macros for the suspend and resume functions to be
automatically dropped by the compiler when CONFIG_PM or
CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>

---
Cc: Ray Jui <[email protected]>
Cc: Scott Branden <[email protected]>
Cc: Broadcom internal kernel review list <[email protected]>
Cc: [email protected]
---
drivers/i2c/busses/i2c-bcm-iproc.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c
index 2d8342fdc25d..8a3e2208475c 100644
--- a/drivers/i2c/busses/i2c-bcm-iproc.c
+++ b/drivers/i2c/busses/i2c-bcm-iproc.c
@@ -1125,8 +1125,6 @@ static void bcm_iproc_i2c_remove(struct platform_device *pdev)
bcm_iproc_i2c_enable_disable(iproc_i2c, false);
}

-#ifdef CONFIG_PM_SLEEP
-
static int bcm_iproc_i2c_suspend(struct device *dev)
{
struct bcm_iproc_i2c_dev *iproc_i2c = dev_get_drvdata(dev);
@@ -1177,12 +1175,6 @@ static const struct dev_pm_ops bcm_iproc_i2c_pm_ops = {
.resume_early = &bcm_iproc_i2c_resume
};

-#define BCM_IPROC_I2C_PM_OPS (&bcm_iproc_i2c_pm_ops)
-#else
-#define BCM_IPROC_I2C_PM_OPS NULL
-#endif /* CONFIG_PM_SLEEP */
-
-
static int bcm_iproc_i2c_reg_slave(struct i2c_client *slave)
{
struct bcm_iproc_i2c_dev *iproc_i2c = i2c_get_adapdata(slave->adapter);
@@ -1255,7 +1247,7 @@ static struct platform_driver bcm_iproc_i2c_driver = {
.driver = {
.name = "bcm-iproc-i2c",
.of_match_table = bcm_iproc_i2c_of_match,
- .pm = BCM_IPROC_I2C_PM_OPS,
+ .pm = pm_sleep_ptr(&bcm_iproc_i2c_pm_ops),
},
.probe = bcm_iproc_i2c_probe,
.remove_new = bcm_iproc_i2c_remove,
--
2.40.1



2023-07-06 02:29:36

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH 03/23] i2c: iproc: Remove #ifdef guards for PM related functions

On Wed, 5 Jul 2023 22:42:54 +0200
Paul Cercueil <[email protected]> wrote:

> Use the new PM macros for the suspend and resume functions to be
> automatically dropped by the compiler when CONFIG_PM or
> CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.
>
> This has the advantage of always compiling these functions in,
> independently of any Kconfig option. Thanks to that, bugs and other
> regressions are subsequently easier to catch.
>
> Signed-off-by: Paul Cercueil <[email protected]>

Reviewed-by: Jonathan Cameron <[email protected]>

2023-07-06 17:14:10

by Ray Jui

[permalink] [raw]
Subject: Re: [PATCH 03/23] i2c: iproc: Remove #ifdef guards for PM related functions



On 7/5/2023 1:42 PM, Paul Cercueil wrote:
> Use the new PM macros for the suspend and resume functions to be
> automatically dropped by the compiler when CONFIG_PM or
> CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.
>
> This has the advantage of always compiling these functions in,
> independently of any Kconfig option. Thanks to that, bugs and other
> regressions are subsequently easier to catch.
>
> Signed-off-by: Paul Cercueil <[email protected]>
>
> ---
> Cc: Ray Jui <[email protected]>
> Cc: Scott Branden <[email protected]>
> Cc: Broadcom internal kernel review list <[email protected]>
> Cc: [email protected]
> ---
> drivers/i2c/busses/i2c-bcm-iproc.c | 10 +---------
> 1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c
> index 2d8342fdc25d..8a3e2208475c 100644
> --- a/drivers/i2c/busses/i2c-bcm-iproc.c
> +++ b/drivers/i2c/busses/i2c-bcm-iproc.c
> @@ -1125,8 +1125,6 @@ static void bcm_iproc_i2c_remove(struct platform_device *pdev)
> bcm_iproc_i2c_enable_disable(iproc_i2c, false);
> }
>
> -#ifdef CONFIG_PM_SLEEP
> -
> static int bcm_iproc_i2c_suspend(struct device *dev)
> {
> struct bcm_iproc_i2c_dev *iproc_i2c = dev_get_drvdata(dev);
> @@ -1177,12 +1175,6 @@ static const struct dev_pm_ops bcm_iproc_i2c_pm_ops = {
> .resume_early = &bcm_iproc_i2c_resume
> };
>
> -#define BCM_IPROC_I2C_PM_OPS (&bcm_iproc_i2c_pm_ops)
> -#else
> -#define BCM_IPROC_I2C_PM_OPS NULL
> -#endif /* CONFIG_PM_SLEEP */
> -
> -
> static int bcm_iproc_i2c_reg_slave(struct i2c_client *slave)
> {
> struct bcm_iproc_i2c_dev *iproc_i2c = i2c_get_adapdata(slave->adapter);
> @@ -1255,7 +1247,7 @@ static struct platform_driver bcm_iproc_i2c_driver = {
> .driver = {
> .name = "bcm-iproc-i2c",
> .of_match_table = bcm_iproc_i2c_of_match,
> - .pm = BCM_IPROC_I2C_PM_OPS,
> + .pm = pm_sleep_ptr(&bcm_iproc_i2c_pm_ops),
> },
> .probe = bcm_iproc_i2c_probe,
> .remove_new = bcm_iproc_i2c_remove,

Thanks.

Acked-by: Ray Jui <[email protected]>


Attachments:
smime.p7s (4.10 kB)
S/MIME Cryptographic Signature