serial: 8250_dw: Drop PM ifdeffery
Subsystems (3)
Andy Shevchenko
reviewerPATCH 1/1 serial: 8250_dw: Drop PM ifdeffery
Drop CONFIG_PM and CONFIG_PM_SLEEP ifdeffery while converting dw8250_pm_ops to use new PM macros.
--- drivers/tty/serial/8250/8250_dw.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/tty/serial/8250/8250_dw.c +2 -6
@@ -691,7 +691,6 @@ static int dw8250_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int dw8250_suspend (struct device *dev) {struct dw8250_data *data =dev_get_drvdata (dev);
@@ -709,9 +708,7 @@ static int dw8250_resume(struct device *dev)return 0 ; } -#endif /* CONFIG_PM_SLEEP */ -#ifdef CONFIG_PM static int dw8250_runtime_suspend (struct device *dev) {struct dw8250_data *data =dev_get_drvdata (dev);
@@ -733,11 +730,10 @@ static int dw8250_runtime_resume(struct device *dev)return 0 ; } -#endif static const struct dev_pm_ops dw8250_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(dw8250_suspend, dw8250_resume) -SET_RUNTIME_PM_OPS (dw8250_runtime_suspend, dw8250_runtime_resume,NULL ) + SYSTEM_SLEEP_PM_OPS(dw8250_suspend, dw8250_resume) +RUNTIME_PM_OPS (dw8250_runtime_suspend, dw8250_runtime_resume,NULL ) };static const struct dw8250_platform_data dw8250_dw_apb = {
Signature · 1 line
2.35.1
Quoted 4 lines · Andy Shevchenko
Drop
CONFIG_PMandCONFIG_PM_SLEEPifdeffery while convertingdw8250_pm_opsto use new PM macros.Signed-off-by Andy Shevchenko <[email protected]>
Not directily related to the patch itself but do you have any idea why 1a3c7bb08826 ("PM: core: Add new *_PM_OPS macros, deprecate old ones") didn't wrap RUNTIME_PM_OPS() pointers with pm_ptr()? I'm asking this because in SET_RUNTIME_PM_OPS() the callbacks are only created with #ifdef CONFIG_PM so I'd have expected RUNTIME_PM_OPS() to maintain that behavior but it didn't? Was it just an oversight that should be fixed?
Signature · 1 line
i.
Quoted 41 lines
--- drivers/tty/serial/8250/8250_dw.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/tty/serial/8250/8250_dw.c +2
-6@@ -691,7 +691,6 @@ static int dw8250_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int dw8250_suspend (struct device *dev) {struct dw8250_data *data =dev_get_drvdata (dev);@@ -709,9 +708,7 @@ static int dw8250_resume(struct device *dev)return 0 ; } -#endif /* CONFIG_PM_SLEEP */ -#ifdef CONFIG_PM static int dw8250_runtime_suspend (struct device *dev) {struct dw8250_data *data =dev_get_drvdata (dev);@@ -733,11 +730,10 @@ static int dw8250_runtime_resume(struct device *dev)return 0 ; } -#endif static const struct dev_pm_ops dw8250_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(dw8250_suspend, dw8250_resume) -SET_RUNTIME_PM_OPS (dw8250_runtime_suspend, dw8250_runtime_resume,NULL ) + SYSTEM_SLEEP_PM_OPS(dw8250_suspend, dw8250_resume) +RUNTIME_PM_OPS (dw8250_runtime_suspend, dw8250_runtime_resume,NULL ) };static const struct dw8250_platform_data dw8250_dw_apb = {
Quoted 8 lines · Ilpo Järvinen
Quoted 4 lines · Andy Shevchenko
Drop
CONFIG_PMandCONFIG_PM_SLEEPifdeffery while convertingdw8250_pm_opsto use new PM macros.Signed-off-by Andy Shevchenko <[email protected]>
Quoted 8 lines
Reviewed-by Ilpo Järvinen <[email protected]>Not directily related to the patch itself but do you have any idea why
1a3c7bb08826("PM: core: Add new*_PM_OPSmacros, deprecate old ones") didn't wrapRUNTIME_PM_OPS()pointers withpm_ptr()? I'm asking this because inSET_RUNTIME_PM_OPS()the callbacks are only created with #ifdefCONFIG_PMso I'd have expectedRUNTIME_PM_OPS()to maintain that behavior but it didn't? Was it just an oversight that should be fixed?
I have had the same question, but I think it might be related to how PM runtime functions when there is no respective configuration option set.
+Cc: Rafael.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Hi Ilpo,
Quoted 8 lines · Ilpo Järvinen
Quoted 5 lines · Andy Shevchenko
Drop
CONFIG_PMandCONFIG_PM_SLEEPifdeffery while convertingdw8250_pm_ops
to use new PM macros.Signed-off-by Andy Shevchenko <[email protected]>
Quoted 8 lines
Reviewed-by Ilpo Järvinen <[email protected]>Not directily related to the patch itself but do you have any idea why
1a3c7bb08826("PM: core: Add new*_PM_OPSmacros, deprecate old ones") didn't wrapRUNTIME_PM_OPS()pointers withpm_ptr()? I'm asking this because inSET_RUNTIME_PM_OPS()the callbacks are only created with #ifdefCONFIG_PMso I'd have expectedRUNTIME_PM_OPS()to maintain that behavior but it didn't? Was it just an oversight that should be fixed?
The RUNTIME_PM_OPS() does not wrap pointers with pm_ptr(), because the pointer to the dev_pm_ops should only ever be used wrapped with pm_ptr() or pm_sleep_ptr().
Which is not done here.
Andy:
The deference of dw8250_pm_ops should be pm_ptr(&dw8250_pm_ops). If you only had system suspend/resume functions, you'd use pm_sleep_ptr() there.
Cheers,
-Paul
Quoted 49 lines
--
i.Quoted 46 lines
---
drivers/tty/serial/8250/8250_dw.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)diff --git
a/drivers/tty/serial/8250/8250_dw.cb/drivers/tty/serial/8250/8250_dw.c
indexf71428c85562..adcc869352b1100644
---a/drivers/tty/serial/8250/8250_dw.c
+++b/drivers/tty/serial/8250/8250_dw.c
@@ -691,7 +691,6 @@ static int dw8250_remove(structplatform_device
*pdev)
return 0;
}-#ifdef
CONFIG_PM_SLEEP
static intdw8250_suspend(struct device *dev)
{
structdw8250_data*data =dev_get_drvdata(dev);
@@ -709,9 +708,7 @@ static intdw8250_resume(struct device *dev)return 0;
}
-#endif /*CONFIG_PM_SLEEP*/-#ifdef
CONFIG_PM
static intdw8250_runtime_suspend(struct device *dev){
structdw8250_data*data =dev_get_drvdata(dev);
@@ -733,11 +730,10 @@ static int dw8250_runtime_resume(struct
device *dev)return 0;
}
-#endifstatic const struct
dev_pm_opsdw8250_pm_ops= {
-SET_SYSTEM_SLEEP_PM_OPS(dw8250_suspend, dw8250_resume)
- SET_RUNTIME_PM_OPS(dw8250_runtime_suspend,dw8250_runtime_resume,
NULL)
+SYSTEM_SLEEP_PM_OPS(dw8250_suspend, dw8250_resume)
+ RUNTIME_PM_OPS(dw8250_runtime_suspend,dw8250_runtime_resume,
NULL)
};static const struct dw8250_platform_data dw8250_dw_apb = {
Ilpo Järvinen
maintainerQuoted 21 lines · Paul Cercueil
Hi Ilpo,
Quoted 8 lines · Ilpo Järvinen
Quoted 5 lines · Andy Shevchenko
Drop
CONFIG_PMandCONFIG_PM_SLEEPifdeffery while convertingdw8250_pm_ops
to use new PM macros.Signed-off-by Andy Shevchenko <[email protected]>Quoted 8 lines
Reviewed-by Ilpo Järvinen <[email protected]>Not directily related to the patch itself but do you have any idea why
1a3c7bb08826("PM: core: Add new*_PM_OPSmacros, deprecate old ones") didn't wrapRUNTIME_PM_OPS()pointers withpm_ptr()? I'm asking this because inSET_RUNTIME_PM_OPS()the callbacks are only created with #ifdefCONFIG_PMso I'd have expectedRUNTIME_PM_OPS()to maintain that behavior but it didn't? Was it just an oversight that should be fixed?
Quoted 5 lines
The
RUNTIME_PM_OPS()does not wrap pointers withpm_ptr(), because the pointer to thedev_pm_opsshould only ever be used wrapped withpm_ptr()orpm_sleep_ptr().Which is not done here.
Ok, thanks a lot for the explanation. It's really appreciated.
Signature · 1 line
i.
Quoted 3 lines
Andy:
The deference ofdw8250_pm_opsshould bepm_ptr(&dw8250_pm_ops). If you only had system suspend/resume functions, you'd usepm_sleep_ptr()there.
Andy Shevchenko
reviewerQuoted 11 lines · Paul Cercueil
Quoted 9 lines · Ilpo Järvinen
Quoted 5 lines · Andy Shevchenko
Drop
CONFIG_PMandCONFIG_PM_SLEEPifdeffery while convertingdw8250_pm_ops
to use new PM macros.Signed-off-by Andy Shevchenko <[email protected]>Reviewed-by Ilpo Järvinen <[email protected]>
I will drop this for v2.
Quoted 11 lines
Quoted 6 lines
Not directily related to the patch itself but do you have any idea why
1a3c7bb08826("PM: core: Add new*_PM_OPSmacros, deprecate old ones") didn't wrapRUNTIME_PM_OPS()pointers withpm_ptr()? I'm asking this because inSET_RUNTIME_PM_OPS()the callbacks are only created with #ifdefCONFIG_PMso I'd have expectedRUNTIME_PM_OPS()to maintain that behavior but it didn't? Was it just an oversight that should be fixed?The
RUNTIME_PM_OPS()does not wrap pointers withpm_ptr(), because the pointer to thedev_pm_opsshould only ever be used wrapped withpm_ptr()orpm_sleep_ptr().
Quoted 5 lines
Which is not done here.
Andy:
The deference ofdw8250_pm_opsshould bepm_ptr(&dw8250_pm_ops). If you only had system suspend/resume functions, you'd usepm_sleep_ptr()there.
Right, it's a shame how I forgot that while telling everybody to use them.
Thanks, Paul!
Signature · 2 lines
With Best Regards, Andy Shevchenko