Skip to contentSkip to conversation

mfd: maxim: remove unnecessary CONFIG_PM_SLEEP

PATCH In review Coiby Xu 7 participants 23 messages Oct 29, 2020 – Nov 2, 2020

Subsystems (7)
lore
Share & tools
lore

Coiby Xu

author
#0 lore raw

PATCH 1/9 mfd: maxim: remove unnecessary CONFIG_PM_SLEEP

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

---
 drivers/mfd/max77686.c | 2 --
 1 file changed, 2 deletions(-)
drivers/mfd/max77686.c +0 -2
index 71faf503844b..8c701f8a9dd5 100644
@@ -227,7 +227,6 @@ static int max77686_i2c_probe(struct i2c_client *i2c)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int max77686_suspend(struct device *dev)
 {
 	struct i2c_client *i2c = to_i2c_client(dev);
@@ -262,7 +261,6 @@ static int max77686_resume(struct device *dev)
 
 	return 0;
 }
-#endif /* CONFIG_PM_SLEEP */
 
 static SIMPLE_DEV_PM_OPS(max77686_pm, max77686_suspend, max77686_resume);
 
Signature · 1 line
2.28.0
author
#1 lore raw

PATCH 2/9 mfd: motorola-cpcap: remove unnecessary CONFIG_PM_SLEEP

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

---
 drivers/mfd/motorola-cpcap.c | 2 --
 1 file changed, 2 deletions(-)
drivers/mfd/motorola-cpcap.c +0 -2
index 2283d88adcc2..97c07a5641c5 100644
@@ -214,7 +214,6 @@ static const struct regmap_config cpcap_regmap_config = {
 	.val_format_endian = REGMAP_ENDIAN_LITTLE,
 };
 
-#ifdef CONFIG_PM_SLEEP
 static int cpcap_suspend(struct device *dev)
 {
 	struct spi_device *spi = to_spi_device(dev);
@@ -232,7 +231,6 @@ static int cpcap_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(cpcap_pm, cpcap_suspend, cpcap_resume);
 
Signature · 1 line
2.28.0
author
#2 lore raw

PATCH 3/9 mfd: intel_soc_pmic: remove unnecessary CONFIG_PM_SLEEP

In reply to Coiby Xu

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

---
 drivers/mfd/intel_soc_pmic_core.c | 2 --
 1 file changed, 2 deletions(-)
drivers/mfd/intel_soc_pmic_core.c +0 -2
index ddd64f9e3341..c980af9ae1c0 100644
@@ -122,7 +122,6 @@ static void intel_soc_pmic_shutdown(struct i2c_client *i2c)
 	return;
 }
 
-#if defined(CONFIG_PM_SLEEP)
 static int intel_soc_pmic_suspend(struct device *dev)
 {
 	struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
@@ -140,7 +139,6 @@ static int intel_soc_pmic_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(intel_soc_pmic_pm_ops, intel_soc_pmic_suspend,
 			 intel_soc_pmic_resume);
Signature · 1 line
2.28.0
#3 lore raw

Re: [PATCH 3/9] mfd: intel_soc_pmic: remove unnecessary CONFIG_PM_SLEEP

Quoted 1 line · Coiby Xu

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Have you compiled this with

	% make W=1 ...

?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author
#4 lore raw

Re: [PATCH 3/9] mfd: intel_soc_pmic: remove unnecessary CONFIG_PM_SLEEP

Quoted 7 lines · Andy Shevchenko
Quoted 1 line · Coiby Xu

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Have you compiled this with

	% make W=1 ...

?

Sorry my bad. I thought I had run "make modules" with CONFIG_PM_SLEEP disabled. I'll run "make W=1 M=..." for each driver after adding __maybe_unused in v2.

Quoted 6 lines

--
With Best Regards,
Andy Shevchenko

--
Best regards,
Coiby

#5 lore raw

Re: [PATCH 3/9] mfd: intel_soc_pmic: remove unnecessary CONFIG_PM_SLEEP

Quoted 4 lines · Coiby Xu
Quoted 3 lines · Andy Shevchenko
Quoted 1 line · Coiby Xu

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Quoted 8 lines
Quoted 4 lines

Have you compiled this with

	% make W=1 ...

?

Sorry my bad. I thought I had run "make modules" with CONFIG_PM_SLEEP disabled. I'll run "make W=1 M=..." for each driver after adding __maybe_unused in v2.

No, thank you. Just keep it as it is.

The current code is space saving.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
#6 lore raw

Re: [PATCH 3/9] mfd: intel_soc_pmic: remove unnecessary CONFIG_PM_SLEEP

Quoted 10 lines · Lee Jones
Quoted 9 lines · Coiby Xu
Quoted 7 lines · Andy Shevchenko
Quoted 1 line · Coiby Xu

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Have you compiled this with

    % make W=1 ...

?

Quoted 7 lines
Quoted 3 lines

Sorry my bad. I thought I had run "make modules" with CONFIG_PM_SLEEP disabled. I'll run "make W=1 M=..." for each driver after adding __maybe_unused in v2.

No, thank you. Just keep it as it is.

The current code is space saving.

Perhaps you need to go thru __maybe_unused handling. There are pros and cons of each approach, but not above.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author
#7 lore raw

Re: [PATCH 3/9] mfd: intel_soc_pmic: remove unnecessary CONFIG_PM_SLEEP

Quoted 15 lines · Andy Shevchenko
Quoted 14 lines · Lee Jones
Quoted 12 lines · Coiby Xu
Quoted 7 lines · Andy Shevchenko
Quoted 1 line · Coiby Xu

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Have you compiled this with

    % make W=1 ...

?

Sorry my bad. I thought I had run "make modules" with CONFIG_PM_SLEEP disabled. I'll run "make W=1 M=..." for each driver after adding __maybe_unused in v2.

Quoted 7 lines
Quoted 3 lines

No, thank you. Just keep it as it is.

The current code is space saving.

Perhaps you need to go thru __maybe_unused handling. There are pros and cons of each approach, but not above.

Can you elaborate on the pros and cons of each approach? There's convincing reason to prefer __maybe_unused over CONFIG_PM_SLEEP according to Arnd Bergmann [1],

Quoted 22 lines
Quoted 4 lines

By and large, drivers handle this by using a CONFIG_PM_SLEEP ifdef.

Unless you can make an extremely convincing argument why not to do so here, I'd like you to handle it that way instead.

[adding linux-pm to Cc]

The main reason is that everyone gets the #ifdef wrong, I run into half a dozen new build regressions with linux-next every week on average, the typical problems being:

- testing CONFIG_PM_SLEEP instead of CONFIG_PM, leading to an unused function warning
- testing CONFIG_PM instead of CONFIG_PM_SLEEP, leading to a build failure
- calling a function outside of the #ifdef only from inside an otherwise correct #ifdef, again leading to an unused function warning
- causing a warning inside of the #ifdef but only testing if that is disabled, leading to a problem if the macro is set (this is rare these days for CONFIG_PM as that is normally enabled)

Quoted 1 line

Using __maybe_unused avoids all of the above.

You option is valuable to me because I'm making a tree-wide change.

Currently there are 929 drivers having device PM callbacks,

$ grep -rI "\.pm = &" --include=*.c  ./|wc -l
929

I put all files having device PM callbacks into four categories based on weather a file has CONFIG_PM_SLEEP or PM macro like SET_SYSTEM_SLEEP_PM_OPS, here are the statistics,
  1. have both CONFIG_PM_SLEEP and PM_OPS macro: 213
  2. have CONFIG_PM_SLEEP but no PM_OPS macro: 19
  3. have PM macro but not CONFIG_PM_SLEEP: 347
  4. no PM macro or CONFIG_PM_SLEEP: 302

[1] https://lore.kernel.org/patchwork/comment/919944/

Quoted 3 lines

--
With Best Regards,
Andy Shevchenko

--
Best regards,
Coiby

#8 lore raw

Re: [PATCH 3/9] mfd: intel_soc_pmic: remove unnecessary CONFIG_PM_SLEEP

Quoted 2 lines · Coiby Xu
Quoted 1 line · Andy Shevchenko

On Thu, Oct 29, 2020 at 5:27 PM Lee Jones <[email protected]> wrote:

...

Quoted 5 lines
Quoted 2 lines

There are pros and cons of each approach, but not above.

Can you elaborate on the pros and cons of each approach? There's convincing reason to prefer __maybe_unused over CONFIG_PM_SLEEP according to Arnd Bergmann [1],

First what comes to my mind. Perhaps more, but somebody else may extend / correct below.

ifdeffery (pros):
- compiler doesn't need even to look at that code

ifdeffery (cons):
- if depends on configuration and thus harder to test coverage

__maybe_unused (pros):
- removes ugly ifdeffery in the code, increases readability

__maybe_unused (cons):
- it's a burden for compiler (increasing compilation time) and to
linker (to drop the section)

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#9 lore raw

Re: [PATCH 3/9] mfd: intel_soc_pmic: remove unnecessary CONFIG_PM_SLEEP

In reply to Andy Shevchenko
Quoted 15 lines · Andy Shevchenko
Quoted 14 lines · Lee Jones
Quoted 12 lines · Coiby Xu
Quoted 7 lines · Andy Shevchenko
Quoted 1 line · Coiby Xu

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Have you compiled this with

    % make W=1 ...

?

Sorry my bad. I thought I had run "make modules" with CONFIG_PM_SLEEP disabled. I'll run "make W=1 M=..." for each driver after adding __maybe_unused in v2.

Quoted 6 lines
Quoted 3 lines

No, thank you. Just keep it as it is.

The current code is space saving.

Perhaps you need to go thru __maybe_unused handling. There are pros and cons of each approach, but not above.

Do you know that all compilers drop the section?

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
#10 lore raw

Re: [PATCH 3/9] mfd: intel_soc_pmic: remove unnecessary CONFIG_PM_SLEEP

Quoted 16 lines · Lee Jones
Quoted 15 lines · Andy Shevchenko
Quoted 14 lines · Lee Jones
Quoted 12 lines · Coiby Xu
Quoted 7 lines · Andy Shevchenko
Quoted 1 line · Coiby Xu

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Have you compiled this with

    % make W=1 ...

?

Sorry my bad. I thought I had run "make modules" with CONFIG_PM_SLEEP disabled. I'll run "make W=1 M=..." for each driver after adding __maybe_unused in v2.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

No, thank you. Just keep it as it is.

The current code is space saving.

Perhaps you need to go thru __maybe_unused handling. There are pros and cons of each approach, but not above.

Do you know that all compilers drop the section?

At least all that Linux kernel can be officially built with.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#11 lore raw

Re: [PATCH 3/9] mfd: intel_soc_pmic: remove unnecessary CONFIG_PM_SLEEP

Quoted 19 lines · Andy Shevchenko
Quoted 18 lines · Lee Jones
Quoted 17 lines · Andy Shevchenko
Quoted 16 lines · Lee Jones
Quoted 4 lines · Coiby Xu
Quoted 3 lines · Andy Shevchenko
Quoted 1 line · Coiby Xu

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Quoted 8 lines
Quoted 4 lines

Have you compiled this with

    % make W=1 ...

?

Sorry my bad. I thought I had run "make modules" with CONFIG_PM_SLEEP disabled. I'll run "make W=1 M=..." for each driver after adding __maybe_unused in v2.

No, thank you. Just keep it as it is.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

The current code is space saving.

Perhaps you need to go thru __maybe_unused handling. There are pros and cons of each approach, but not above.

Do you know that all compilers drop the section?

At least all that Linux kernel can be officially built with.

Fair enough.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#12 lore raw

PATCH 4/9 mfd: max77620: remove unnecessary CONFIG_PM_SLEEP

In reply to Coiby Xu

SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

---
 drivers/mfd/max77620.c | 2 --
 1 file changed, 2 deletions(-)
drivers/mfd/max77620.c +0 -2
index fec2096474ad..17ea0ae6408d 100644
@@ -574,7 +574,6 @@ static int max77620_probe(struct i2c_client *client,
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int max77620_set_fps_period(struct max77620_chip *chip,
 				   int fps_id, int time_period)
 {
@@ -681,7 +680,6 @@ static int max77620_i2c_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
 static const struct i2c_device_id max77620_id[] = {
 	{"max77620", MAX77620},
Signature · 1 line
2.28.0
author
#13 lore raw

PATCH 5/9 mfd: stpmic1: remove unnecessary CONFIG_PM_SLEEP

In reply to Coiby Xu

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

---
 drivers/mfd/stpmic1.c | 2 --
 1 file changed, 2 deletions(-)
drivers/mfd/stpmic1.c +0 -2
index eb3da558c3fb..8be7a6dd9bbb 100644
@@ -162,7 +162,6 @@ static int stpmic1_probe(struct i2c_client *i2c,
 	return devm_of_platform_populate(dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int stpmic1_suspend(struct device *dev)
 {
 	struct i2c_client *i2c = to_i2c_client(dev);
@@ -187,7 +186,6 @@ static int stpmic1_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(stpmic1_pm, stpmic1_suspend, stpmic1_resume);
 
Signature · 1 line
2.28.0
author
#14 lore raw

PATCH 6/9 mfd: stmfx: remove unnecessary CONFIG_PM_SLEEP

In reply to Coiby Xu

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

---
 drivers/mfd/stmfx.c | 2 --
 1 file changed, 2 deletions(-)
drivers/mfd/stmfx.c +0 -2
index 5e680bfdf5c9..e760cf2be02e 100644
@@ -469,7 +469,6 @@ static int stmfx_remove(struct i2c_client *client)
 	return stmfx_chip_exit(client);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int stmfx_suspend(struct device *dev)
 {
 	struct stmfx *stmfx = dev_get_drvdata(dev);
@@ -535,7 +534,6 @@ static int stmfx_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(stmfx_dev_pm_ops, stmfx_suspend, stmfx_resume);
 
Signature · 1 line
2.28.0
#15 lore raw

Re: [PATCH 6/9] mfd: stmfx: remove unnecessary CONFIG_PM_SLEEP

Thank you for the patch! Yet something to improve:

Hi Coiby,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on lee-mfd/for-mfd-next]
[also build test ERROR on chanwoo-extcon/extcon-next v5.10-rc1 next-20201029] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Coiby-Xu/mfd-maxim-remove-unnecessary-CONFIG_PM_SLEEP/20201029-180931
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: s390-allyesconfig (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/af64db6e5065ea1b51445005e0e675f8a49db5ec
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Coiby-Xu/mfd-maxim-remove-unnecessary-CONFIG_PM_SLEEP/20201029-180931 git checkout af64db6e5065ea1b51445005e0e675f8a49db5ec
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=s390

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

drivers/mfd/stmfx.c: In function 'stmfx_suspend':

>> drivers/mfd/stmfx.c:478:16: error: 'struct stmfx' has no member named 'bkp_sysctrl'
     478 |          &stmfx->bkp_sysctrl, sizeof(stmfx->bkp_sysctrl));
         |                ^~
   drivers/mfd/stmfx.c:478:43: error: 'struct stmfx' has no member named 'bkp_sysctrl'
     478 |          &stmfx->bkp_sysctrl, sizeof(stmfx->bkp_sysctrl));
         |                                           ^~
>> drivers/mfd/stmfx.c:483:16: error: 'struct stmfx' has no member named 'bkp_irqoutpin'
     483 |          &stmfx->bkp_irqoutpin,
         |                ^~
   drivers/mfd/stmfx.c:484:22: error: 'struct stmfx' has no member named 'bkp_irqoutpin'
     484 |          sizeof(stmfx->bkp_irqoutpin));
         |                      ^~
   drivers/mfd/stmfx.c: In function 'stmfx_resume':
   drivers/mfd/stmfx.c:518:17: error: 'struct stmfx' has no member named 'bkp_sysctrl'
     518 |           &stmfx->bkp_sysctrl, sizeof(stmfx->bkp_sysctrl));
         |                 ^~
   drivers/mfd/stmfx.c:518:44: error: 'struct stmfx' has no member named 'bkp_sysctrl'
     518 |           &stmfx->bkp_sysctrl, sizeof(stmfx->bkp_sysctrl));
         |                                            ^~
   drivers/mfd/stmfx.c:523:17: error: 'struct stmfx' has no member named 'bkp_irqoutpin'
     523 |           &stmfx->bkp_irqoutpin,
         |                 ^~
   drivers/mfd/stmfx.c:524:23: error: 'struct stmfx' has no member named 'bkp_irqoutpin'
     524 |           sizeof(stmfx->bkp_irqoutpin));
         |                       ^~

At top level:
drivers/mfd/stmfx.c:496:12: warning: 'stmfx_resume' defined but not used [-Wunused-function]
496 | static int stmfx_resume(struct device *dev)
| ^~~~~~~~~~~~
drivers/mfd/stmfx.c:472:12: warning: 'stmfx_suspend' defined but not used [-Wunused-function]
472 | static int stmfx_suspend(struct device *dev)
| ^~~~~~~~~~~~~

vim +478 drivers/mfd/stmfx.c

06252ade9156657 Amelie Delaunay 2019-05-09  471  
06252ade9156657 Amelie Delaunay 2019-05-09  472  static int stmfx_suspend(struct device *dev)
06252ade9156657 Amelie Delaunay 2019-05-09  473  {
06252ade9156657 Amelie Delaunay 2019-05-09  474  	struct stmfx *stmfx = dev_get_drvdata(dev);
06252ade9156657 Amelie Delaunay 2019-05-09  475  	int ret;
06252ade9156657 Amelie Delaunay 2019-05-09  476  
06252ade9156657 Amelie Delaunay 2019-05-09  477  	ret = regmap_raw_read(stmfx->map, STMFX_REG_SYS_CTRL,
06252ade9156657 Amelie Delaunay 2019-05-09 @478  			      &stmfx->bkp_sysctrl, sizeof(stmfx->bkp_sysctrl));
06252ade9156657 Amelie Delaunay 2019-05-09  479  	if (ret)
06252ade9156657 Amelie Delaunay 2019-05-09  480  		return ret;
06252ade9156657 Amelie Delaunay 2019-05-09  481  
06252ade9156657 Amelie Delaunay 2019-05-09  482  	ret = regmap_raw_read(stmfx->map, STMFX_REG_IRQ_OUT_PIN,
06252ade9156657 Amelie Delaunay 2019-05-09 @483  			      &stmfx->bkp_irqoutpin,
06252ade9156657 Amelie Delaunay 2019-05-09  484  			      sizeof(stmfx->bkp_irqoutpin));
06252ade9156657 Amelie Delaunay 2019-05-09  485  	if (ret)
06252ade9156657 Amelie Delaunay 2019-05-09  486  		return ret;
06252ade9156657 Amelie Delaunay 2019-05-09  487  
97eda5dcc2cde5d Amelie Delaunay 2020-04-22  488  	disable_irq(stmfx->irq);
97eda5dcc2cde5d Amelie Delaunay 2020-04-22  489  
06252ade9156657 Amelie Delaunay 2019-05-09  490  	if (stmfx->vdd)
06252ade9156657 Amelie Delaunay 2019-05-09  491  		return regulator_disable(stmfx->vdd);
06252ade9156657 Amelie Delaunay 2019-05-09  492  
06252ade9156657 Amelie Delaunay 2019-05-09  493  	return 0;
06252ade9156657 Amelie Delaunay 2019-05-09  494  }
06252ade9156657 Amelie Delaunay 2019-05-09  495  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

author
#16 lore raw

PATCH 7/9 mfd: sec: remove unnecessary CONFIG_PM_SLEEP

In reply to Coiby Xu

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

---
 drivers/mfd/sec-core.c | 2 --
 1 file changed, 2 deletions(-)
drivers/mfd/sec-core.c +0 -2
index 95473ff9bb4b..a5d19798d671 100644
@@ -496,7 +496,6 @@ static void sec_pmic_shutdown(struct i2c_client *i2c)
 	regmap_update_bits(sec_pmic->regmap_pmic, reg, mask, 0);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int sec_pmic_suspend(struct device *dev)
 {
 	struct i2c_client *i2c = to_i2c_client(dev);
@@ -529,7 +528,6 @@ static int sec_pmic_resume(struct device *dev)
 
 	return 0;
 }
-#endif /* CONFIG_PM_SLEEP */
 
 static SIMPLE_DEV_PM_OPS(sec_pmic_pm_ops, sec_pmic_suspend, sec_pmic_resume);
 
Signature · 1 line
2.28.0
author
#17 lore raw

PATCH 8/9 mfd: max14577: remove unnecessary CONFIG_PM_SLEEP

In reply to Coiby Xu

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

---
 drivers/mfd/max14577.c | 2 --
 1 file changed, 2 deletions(-)
drivers/mfd/max14577.c +0 -2
index be185e9d5f16..c619dd8172d5 100644
@@ -482,7 +482,6 @@ static const struct i2c_device_id max14577_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, max14577_i2c_id);
 
-#ifdef CONFIG_PM_SLEEP
 static int max14577_suspend(struct device *dev)
 {
 	struct i2c_client *i2c = to_i2c_client(dev);
@@ -515,7 +514,6 @@ static int max14577_resume(struct device *dev)
 
 	return 0;
 }
-#endif /* CONFIG_PM_SLEEP */
 
 static SIMPLE_DEV_PM_OPS(max14577_pm, max14577_suspend, max14577_resume);
 
Signature · 1 line
2.28.0
author
#18 lore raw

PATCH 9/9 mfd: sprd-sc27xx-spi: remove unnecessary CONFIG_PM_SLEEP

In reply to Coiby Xu

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

---
 drivers/mfd/sprd-sc27xx-spi.c | 2 --
 1 file changed, 2 deletions(-)
drivers/mfd/sprd-sc27xx-spi.c +0 -2
index 6b7956604a0f..4db2ec9ef2ff 100644
@@ -206,7 +206,6 @@ static int sprd_pmic_probe(struct spi_device *spi)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int sprd_pmic_suspend(struct device *dev)
 {
 	struct sprd_pmic *ddata = dev_get_drvdata(dev);
@@ -226,7 +225,6 @@ static int sprd_pmic_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(sprd_pmic_pm_ops, sprd_pmic_suspend, sprd_pmic_resume);
 
Signature · 1 line
2.28.0
reviewer
#19 lore raw

Re: [PATCH 9/9] mfd: sprd-sc27xx-spi: remove unnecessary CONFIG_PM_SLEEP

Hi Coiby,

After removing CONFIG_PM_SLEEP, sprd_pmic_suspend/resume() would not be built into symbol table with clang compiler though, that would cause clang compiler report warnings of "unused function" if CONFIG_PM_SLEEP is not set. So I also prefer to add a __maybe_unused instead as other people suggested in the mail list.

Thanks,
Chunyan

Quoted 2 lines · Coiby Xu

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG. Signed-off-by: Coiby Xu <[email protected]> drivers/mfd/sprd-sc27xx-spi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c index 6b7956604a0f..4db2ec9ef2ff 100644 --- a/drivers/mfd/sprd-sc27xx-spi.c +++ b/drivers/mfd/sprd-sc27xx-spi.c @@ -206,7 +206,6 @@ static int sprd_pmic_probe(struct spi_device *spi) return 0; -#ifdef CONFIG_PM_SLEEP static int sprd_pmic_suspend(struct device *dev) struct sprd_pmic *ddata = dev_get_drvdata(dev); @@ -226,7 +225,6 @@ static int sprd_pmic_resume(struct device *dev) return 0; -#endif static SIMPLE_DEV_PM_OPS(sprd_pmic_pm_ops, sprd_pmic_suspend, sprd_pmic_resume); 2.28.0

author
#20 lore raw

Re: [PATCH 9/9] mfd: sprd-sc27xx-spi: remove unnecessary CONFIG_PM_SLEEP

Hi Chunyan,

Quoted 8 lines · Chunyan Zhang

Hi Coiby,

After removing CONFIG_PM_SLEEP, sprd_pmic_suspend/resume() would not be built into symbol table with clang compiler though, that would cause clang compiler report warnings of "unused function" if CONFIG_PM_SLEEP is not set. So I also prefer to add a __maybe_unused instead as other people suggested in the mail list.

Thank you for the suggestion! At least Lee prefers to CONFIG_PM_SLEEP thus to keep the status quo. I'll see he'll change his mind with the ongoing discussion [1]:)

[1] https://www.mail-archive.com/[email protected]/msg2361371.html

Quoted 7 lines

Thanks,
Chunyan

Quoted 2 lines · Coiby Xu

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG. Signed-off-by: Coiby Xu <[email protected]> drivers/mfd/sprd-sc27xx-spi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c index 6b7956604a0f..4db2ec9ef2ff 100644 --- a/drivers/mfd/sprd-sc27xx-spi.c +++ b/drivers/mfd/sprd-sc27xx-spi.c @@ -206,7 +206,6 @@ static int sprd_pmic_probe(struct spi_device *spi) return 0; -#ifdef CONFIG_PM_SLEEP static int sprd_pmic_suspend(struct device *dev) struct sprd_pmic *ddata = dev_get_drvdata(dev); @@ -226,7 +225,6 @@ static int sprd_pmic_resume(struct device *dev) return 0; -#endif static SIMPLE_DEV_PM_OPS(sprd_pmic_pm_ops, sprd_pmic_suspend, sprd_pmic_resume); 2.28.0

--
Best regards,
Coiby

#21 lore raw
In reply to Coiby Xu
Quoted 1 line · Coiby Xu

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

I don't quite get what did you mean by "took good care". This should cause warnings of unused structure. Comment applies to other patches as well.

Also, the title prefix is: "mfd: max77686:"

Best regards,
Krzysztof

Quoted 29 lines
---
 drivers/mfd/max77686.c | 2 --
 1 file changed, 2 deletions(-)
drivers/mfd/max77686.c +0 -2
index 71faf503844b..8c701f8a9dd5 100644
@@ -227,7 +227,6 @@ static int max77686_i2c_probe(struct i2c_client *i2c)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int max77686_suspend(struct device *dev)
 {
 	struct i2c_client *i2c = to_i2c_client(dev);
@@ -262,7 +261,6 @@ static int max77686_resume(struct device *dev)
 
 	return 0;
 }
-#endif /* CONFIG_PM_SLEEP */
 
 static SIMPLE_DEV_PM_OPS(max77686_pm, max77686_suspend, max77686_resume);
 
Signature · 1 line
2.28.0
author
#22 lore raw
Quoted 7 lines · Krzysztof Kozlowski
Quoted 1 line · Coiby Xu

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

I don't quite get what did you mean by "took good care". This should cause warnings of unused structure. Comment applies to other patches as well.

Sorry I made a mistake.

Quoted 2 lines

Also, the title prefix is: "mfd: max77686:"

Thank you for the reminding! I'll improve my script to avoid this issue when extracting prefix from git log.

Quoted 28 lines

Best regards,
Krzysztof

Quoted 24 lines
---
 drivers/mfd/max77686.c | 2 --
 1 file changed, 2 deletions(-)
drivers/mfd/max77686.c +0 -2
index 71faf503844b..8c701f8a9dd5 100644
@@ -227,7 +227,6 @@ static int max77686_i2c_probe(struct i2c_client *i2c)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int max77686_suspend(struct device *dev)
 {
 	struct i2c_client *i2c = to_i2c_client(dev);
@@ -262,7 +261,6 @@ static int max77686_resume(struct device *dev)
 
 	return 0;
 }
-#endif /* CONFIG_PM_SLEEP */
 
Quoted 5 lines
Quoted 5 lines
drivers/mfd/max77686.c +0 -1
 static SIMPLE_DEV_PM_OPS(max77686_pm, max77686_suspend, max77686_resume);
 
--

2.28.0

--
Best regards,
Coiby