diff mbox series

i2c: stm32f7: avoid ifdef CONFIG_PM_SLEEP for pm callbacks

Message ID 1615550007-10927-1-git-send-email-alain.volmat@foss.st.com
State Accepted
Commit 010e32ab205bfee3a3e860d0366c1516c3e298f9
Headers show
Series i2c: stm32f7: avoid ifdef CONFIG_PM_SLEEP for pm callbacks | expand

Commit Message

Alain Volmat March 12, 2021, 11:53 a.m. UTC
Avoid CONFIG_PM preprocessor check for pm suspend/resume
callbacks and identify the functions with __maybe_unused.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
---
 drivers/i2c/busses/i2c-stm32f7.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Pierre Yves MORDRET March 18, 2021, 1:05 p.m. UTC | #1
Hi All,

Reviewed-by: Pierre-Yves MORDRET <pierre-yves.mordret@foss.st.com>


Regards

On 3/12/21 12:53 PM, Alain Volmat wrote:
> Avoid CONFIG_PM preprocessor check for pm suspend/resume

> callbacks and identify the functions with __maybe_unused.

> 

> Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>

> ---

>  drivers/i2c/busses/i2c-stm32f7.c | 10 ++++------

>  1 file changed, 4 insertions(+), 6 deletions(-)

> 

> diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c

> index c62c815b88eb..4c2f1b16c5ce 100644

> --- a/drivers/i2c/busses/i2c-stm32f7.c

> +++ b/drivers/i2c/busses/i2c-stm32f7.c

> @@ -2267,8 +2267,7 @@ static int __maybe_unused stm32f7_i2c_runtime_resume(struct device *dev)

>  	return 0;

>  }

>  

> -#ifdef CONFIG_PM_SLEEP

> -static int stm32f7_i2c_regs_backup(struct stm32f7_i2c_dev *i2c_dev)

> +static int __maybe_unused stm32f7_i2c_regs_backup(struct stm32f7_i2c_dev *i2c_dev)

>  {

>  	int ret;

>  	struct stm32f7_i2c_regs *backup_regs = &i2c_dev->backup_regs;

> @@ -2289,7 +2288,7 @@ static int stm32f7_i2c_regs_backup(struct stm32f7_i2c_dev *i2c_dev)

>  	return ret;

>  }

>  

> -static int stm32f7_i2c_regs_restore(struct stm32f7_i2c_dev *i2c_dev)

> +static int __maybe_unused stm32f7_i2c_regs_restore(struct stm32f7_i2c_dev *i2c_dev)

>  {

>  	u32 cr1;

>  	int ret;

> @@ -2320,7 +2319,7 @@ static int stm32f7_i2c_regs_restore(struct stm32f7_i2c_dev *i2c_dev)

>  	return ret;

>  }

>  

> -static int stm32f7_i2c_suspend(struct device *dev)

> +static int __maybe_unused stm32f7_i2c_suspend(struct device *dev)

>  {

>  	struct stm32f7_i2c_dev *i2c_dev = dev_get_drvdata(dev);

>  	int ret;

> @@ -2341,7 +2340,7 @@ static int stm32f7_i2c_suspend(struct device *dev)

>  	return 0;

>  }

>  

> -static int stm32f7_i2c_resume(struct device *dev)

> +static int __maybe_unused stm32f7_i2c_resume(struct device *dev)

>  {

>  	struct stm32f7_i2c_dev *i2c_dev = dev_get_drvdata(dev);

>  	int ret;

> @@ -2361,7 +2360,6 @@ static int stm32f7_i2c_resume(struct device *dev)

>  

>  	return 0;

>  }

> -#endif

>  

>  static const struct dev_pm_ops stm32f7_i2c_pm_ops = {

>  	SET_RUNTIME_PM_OPS(stm32f7_i2c_runtime_suspend,

> 


-- 
--
~ Py MORDRET
--
Wolfram Sang April 6, 2021, 8:40 p.m. UTC | #2
On Fri, Mar 12, 2021 at 12:53:27PM +0100, Alain Volmat wrote:
> Avoid CONFIG_PM preprocessor check for pm suspend/resume

> callbacks and identify the functions with __maybe_unused.

> 

> Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>


Applied to for-next, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
index c62c815b88eb..4c2f1b16c5ce 100644
--- a/drivers/i2c/busses/i2c-stm32f7.c
+++ b/drivers/i2c/busses/i2c-stm32f7.c
@@ -2267,8 +2267,7 @@  static int __maybe_unused stm32f7_i2c_runtime_resume(struct device *dev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int stm32f7_i2c_regs_backup(struct stm32f7_i2c_dev *i2c_dev)
+static int __maybe_unused stm32f7_i2c_regs_backup(struct stm32f7_i2c_dev *i2c_dev)
 {
 	int ret;
 	struct stm32f7_i2c_regs *backup_regs = &i2c_dev->backup_regs;
@@ -2289,7 +2288,7 @@  static int stm32f7_i2c_regs_backup(struct stm32f7_i2c_dev *i2c_dev)
 	return ret;
 }
 
-static int stm32f7_i2c_regs_restore(struct stm32f7_i2c_dev *i2c_dev)
+static int __maybe_unused stm32f7_i2c_regs_restore(struct stm32f7_i2c_dev *i2c_dev)
 {
 	u32 cr1;
 	int ret;
@@ -2320,7 +2319,7 @@  static int stm32f7_i2c_regs_restore(struct stm32f7_i2c_dev *i2c_dev)
 	return ret;
 }
 
-static int stm32f7_i2c_suspend(struct device *dev)
+static int __maybe_unused stm32f7_i2c_suspend(struct device *dev)
 {
 	struct stm32f7_i2c_dev *i2c_dev = dev_get_drvdata(dev);
 	int ret;
@@ -2341,7 +2340,7 @@  static int stm32f7_i2c_suspend(struct device *dev)
 	return 0;
 }
 
-static int stm32f7_i2c_resume(struct device *dev)
+static int __maybe_unused stm32f7_i2c_resume(struct device *dev)
 {
 	struct stm32f7_i2c_dev *i2c_dev = dev_get_drvdata(dev);
 	int ret;
@@ -2361,7 +2360,6 @@  static int stm32f7_i2c_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
 static const struct dev_pm_ops stm32f7_i2c_pm_ops = {
 	SET_RUNTIME_PM_OPS(stm32f7_i2c_runtime_suspend,