Skip to contentSkip to conversation

regulator: mcp16502: Use #ifdef CONFIG_PM_SLEEP around mcp16502_suspend/resume_noirq

PATCH In review Axel Lin 2 participants 2 messages Dec 20, 2018 – Dec 21, 2018

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: mcp16502: Use #ifdef CONFIG_PM_SLEEP around mcp16502_suspend/resume_noirq

mcp16502_suspend/resume_noirq is only used by SET_NOIRQ_SYSTEM_SLEEP_PM_OPS when CONFIG_PM_SLEEP is defined.
So use #ifdef CONFIG_PM_SLEEP instead CONFIG_SUSPEND guard.

---
This patch replaces below patch I sent today.
regulator: mcp16502: Fix build error when !CONFIG_SUSPEND && CONFIG_PM_SLEEP Changed the subject line because after commit 308144ce8e51 ("regulator: mcp16502: code cleanup") it's not related to build error now.

 drivers/regulator/mcp16502.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/regulator/mcp16502.c +2 -5
index 809a664733a4..cb11fb206899 100644
@@ -497,7 +497,7 @@ static int mcp16502_probe(struct i2c_client *client,
 	return 0;
 }
 
-#ifdef CONFIG_SUSPEND
+#ifdef CONFIG_PM_SLEEP
 static int mcp16502_suspend_noirq(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
@@ -517,10 +517,7 @@ static int mcp16502_resume_noirq(struct device *dev)
 
 	return 0;
 }
-#else /* !CONFIG_SUSPEND */
-#define mcp16502_suspend_noirq NULL
-#define mcp16502_resume_noirq NULL
-#endif /* !CONFIG_SUSPEND */
+#endif
 
 #ifdef CONFIG_PM
 static const struct dev_pm_ops mcp16502_pm_ops = {
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Axel Lin

mcp16502_suspend/resume_noirq is only used by SET_NOIRQ_SYSTEM_SLEEP_PM_OPS when CONFIG_PM_SLEEP is defined.
So use #ifdef CONFIG_PM_SLEEP instead CONFIG_SUSPEND guard.

I'm not against this patch and don't know the habits about this... one remark below...

Quoted 14 lines

---
This patch replaces below patch I sent today.
regulator: mcp16502: Fix build error when !CONFIG_SUSPEND && CONFIG_PM_SLEEP Changed the subject line because after commit 308144ce8e51 ("regulator: mcp16502: code cleanup") it's not related to build error now.

  drivers/regulator/mcp16502.c | 7 ++-----
  1 file changed, 2 insertions(+), 5 deletions(-)
drivers/regulator/mcp16502.c +0 -0
index 809a664733a4..cb11fb206899 100644

drivers/regulator/mcp16502.c static int mcp16502_probe(struct i2c_client *client, · line 500

Quoted 5 lines
drivers/regulator/mcp16502.c +1 -1
@@ -497,7 +497,7 @@ static int mcp16502_probe(struct i2c_client *client,
  	return 0;
  }
 
-#ifdef CONFIG_SUSPEND
+#ifdef CONFIG_PM_SLEEP

Why not use CONFIG_PM just like ...

Quoted 4 lines
drivers/regulator/mcp16502.c +0 -0
  static int mcp16502_suspend_noirq(struct device *dev)
  {
  	struct i2c_client *client = to_i2c_client(dev);

drivers/regulator/mcp16502.c static int mcp16502_resume_noirq(struct device *dev) · line 522

Quoted 10 lines
drivers/regulator/mcp16502.c +1 -4
@@ -517,10 +517,7 @@ static int mcp16502_resume_noirq(struct device *dev)
 
  	return 0;
  }
-#else /* !CONFIG_SUSPEND */
-#define mcp16502_suspend_noirq NULL
-#define mcp16502_resume_noirq NULL
-#endif /* !CONFIG_SUSPEND */
+#endif
 
  #ifdef CONFIG_PM

... here.... or unify both directives to "CONFIG_PM_SLEEP" ?

Otherwise, no problem in adding my:

(as Andrei is not with Microchip anymore).

Quoted 2 lines
drivers/regulator/mcp16502.c +0 -0
  static const struct dev_pm_ops mcp16502_pm_ops = {
Signature · 1 line
Nicolas Ferre