All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] serial: 8250_dw: Drop PM ifdeffery
@ 2022-06-28 21:45 Andy Shevchenko
  2022-06-30  7:41 ` Ilpo Järvinen
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2022-06-28 21:45 UTC (permalink / raw)
  To: Andy Shevchenko, Greg Kroah-Hartman, linux-serial, linux-kernel
  Cc: Jiri Slaby

Drop CONFIG_PM and CONFIG_PM_SLEEP ifdeffery while converting dw8250_pm_ops
to use new PM macros.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/tty/serial/8250/8250_dw.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index f71428c85562..adcc869352b1 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -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 = {
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/1] serial: 8250_dw: Drop PM ifdeffery
  2022-06-28 21:45 [PATCH v1 1/1] serial: 8250_dw: Drop PM ifdeffery Andy Shevchenko
@ 2022-06-30  7:41 ` Ilpo Järvinen
  2022-06-30  7:56   ` Andy Shevchenko
  2022-06-30  8:44   ` Paul Cercueil
  0 siblings, 2 replies; 6+ messages in thread
From: Ilpo Järvinen @ 2022-06-30  7:41 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, linux-serial, LKML, Jiri Slaby, Paul Cercueil

[-- Attachment #1: Type: text/plain, Size: 2034 bytes --]

On Wed, 29 Jun 2022, Andy Shevchenko wrote:

> Drop CONFIG_PM and CONFIG_PM_SLEEP ifdeffery while converting dw8250_pm_ops
> to use new PM macros.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

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?

-- 
 i.

> ---
>  drivers/tty/serial/8250/8250_dw.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
> index f71428c85562..adcc869352b1 100644
> --- a/drivers/tty/serial/8250/8250_dw.c
> +++ b/drivers/tty/serial/8250/8250_dw.c
> @@ -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 = {
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/1] serial: 8250_dw: Drop PM ifdeffery
  2022-06-30  7:41 ` Ilpo Järvinen
@ 2022-06-30  7:56   ` Andy Shevchenko
  2022-06-30  8:44   ` Paul Cercueil
  1 sibling, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2022-06-30  7:56 UTC (permalink / raw)
  To: Ilpo Järvinen, Rafael J. Wysocki
  Cc: Andy Shevchenko, Greg Kroah-Hartman, linux-serial, LKML,
	Jiri Slaby, Paul Cercueil

On Thu, Jun 30, 2022 at 9:42 AM Ilpo Järvinen
<ilpo.jarvinen@linux.intel.com> wrote:
>
> On Wed, 29 Jun 2022, Andy Shevchenko wrote:
>
> > Drop CONFIG_PM and CONFIG_PM_SLEEP ifdeffery while converting dw8250_pm_ops
> > to use new PM macros.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
>
> 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?

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.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/1] serial: 8250_dw: Drop PM ifdeffery
  2022-06-30  7:41 ` Ilpo Järvinen
  2022-06-30  7:56   ` Andy Shevchenko
@ 2022-06-30  8:44   ` Paul Cercueil
  2022-06-30  9:00     ` Ilpo Järvinen
  2022-06-30  9:31     ` Andy Shevchenko
  1 sibling, 2 replies; 6+ messages in thread
From: Paul Cercueil @ 2022-06-30  8:44 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Andy Shevchenko, Greg Kroah-Hartman, linux-serial, LKML, Jiri Slaby

Hi Ilpo,

Le jeu., juin 30 2022 at 10:41:40 +0300, Ilpo Järvinen 
<ilpo.jarvinen@linux.intel.com> a écrit :
> On Wed, 29 Jun 2022, Andy Shevchenko wrote:
> 
>>  Drop CONFIG_PM and CONFIG_PM_SLEEP ifdeffery while converting 
>> dw8250_pm_ops
>>  to use new PM macros.
>> 
>>  Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> 
> 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?

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

> --
>  i.
> 
>>  ---
>>   drivers/tty/serial/8250/8250_dw.c | 8 ++------
>>   1 file changed, 2 insertions(+), 6 deletions(-)
>> 
>>  diff --git a/drivers/tty/serial/8250/8250_dw.c 
>> b/drivers/tty/serial/8250/8250_dw.c
>>  index f71428c85562..adcc869352b1 100644
>>  --- a/drivers/tty/serial/8250/8250_dw.c
>>  +++ b/drivers/tty/serial/8250/8250_dw.c
>>  @@ -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 = {
>> 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/1] serial: 8250_dw: Drop PM ifdeffery
  2022-06-30  8:44   ` Paul Cercueil
@ 2022-06-30  9:00     ` Ilpo Järvinen
  2022-06-30  9:31     ` Andy Shevchenko
  1 sibling, 0 replies; 6+ messages in thread
From: Ilpo Järvinen @ 2022-06-30  9:00 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Andy Shevchenko, Greg Kroah-Hartman, linux-serial, LKML, Jiri Slaby

[-- Attachment #1: Type: text/plain, Size: 1363 bytes --]

On Thu, 30 Jun 2022, Paul Cercueil wrote:

> Hi Ilpo,
> 
> Le jeu., juin 30 2022 at 10:41:40 +0300, Ilpo Järvinen
> <ilpo.jarvinen@linux.intel.com> a écrit :
> > On Wed, 29 Jun 2022, Andy Shevchenko wrote:
> > 
> > >  Drop CONFIG_PM and CONFIG_PM_SLEEP ifdeffery while converting
> > > dw8250_pm_ops
> > >  to use new PM macros.
> > > 
> > >  Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > 
> > Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > 
> > 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?
> 
> 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.

Ok, thanks a lot for the explanation. It's really appreciated.

-- 
 i.

> 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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/1] serial: 8250_dw: Drop PM ifdeffery
  2022-06-30  8:44   ` Paul Cercueil
  2022-06-30  9:00     ` Ilpo Järvinen
@ 2022-06-30  9:31     ` Andy Shevchenko
  1 sibling, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2022-06-30  9:31 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Ilpo Järvinen, Greg Kroah-Hartman, linux-serial, LKML, Jiri Slaby

On Thu, Jun 30, 2022 at 09:44:07AM +0100, Paul Cercueil wrote:
> Le jeu., juin 30 2022 at 10:41:40 +0300, Ilpo Järvinen
> <ilpo.jarvinen@linux.intel.com> a écrit :
> > On Wed, 29 Jun 2022, Andy Shevchenko wrote:
> > 
> > >  Drop CONFIG_PM and CONFIG_PM_SLEEP ifdeffery while converting
> > > dw8250_pm_ops
> > >  to use new PM macros.
> > > 
> > >  Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > 
> > Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

I will drop this for v2.

> > 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?
> 
> 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.

Right, it's a shame how I forgot that while telling everybody to use them.

Thanks, Paul!

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-30  9:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-28 21:45 [PATCH v1 1/1] serial: 8250_dw: Drop PM ifdeffery Andy Shevchenko
2022-06-30  7:41 ` Ilpo Järvinen
2022-06-30  7:56   ` Andy Shevchenko
2022-06-30  8:44   ` Paul Cercueil
2022-06-30  9:00     ` Ilpo Järvinen
2022-06-30  9:31     ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.