All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] ata: ahci_da850: switch to DEFINE_SIMPLE_DEV_PM_OPS
@ 2026-09-08  6:10 Li Jun
  2026-09-08  6:13 ` Damien Le Moal
  2026-09-08  6:20 ` sashiko-bot
  0 siblings, 2 replies; 5+ messages in thread
From: Li Jun @ 2026-09-08  6:10 UTC (permalink / raw)
  To: lijun01, dlemoal, cassel, linux-ide

Replace the deprecated SIMPLE_DEV_PM_OPS macro with the recommended
DEFINE_SIMPLE_DEV_PM_OPS. Use pm_ptr(&ahci_da850_pm_ops) to complete
the API migration and allow the structure to be correctly dropped
when CONFIG_PM=n.

Signed-off-by: Li Jun <lijun01@kylinos.cn>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
---
changelogs:
-add pm_ptr for ahci_da850_pm_ops in ahci_da850_driver.
-revise grammar and alignment issues.
---
 drivers/ata/ahci_da850.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/ahci_da850.c b/drivers/ata/ahci_da850.c
index 4e53ff96d712..469cf015bbf0 100644
--- a/drivers/ata/ahci_da850.c
+++ b/drivers/ata/ahci_da850.c
@@ -218,8 +218,8 @@ static int ahci_da850_probe(struct platform_device *pdev)
 	return rc;
 }
 
-static SIMPLE_DEV_PM_OPS(ahci_da850_pm_ops, ahci_platform_suspend,
-			 ahci_platform_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ahci_da850_pm_ops, ahci_platform_suspend,
+								ahci_platform_resume);
 
 static const struct of_device_id ahci_da850_of_match[] = {
 	{ .compatible = "ti,da850-ahci", },
@@ -233,7 +233,7 @@ static struct platform_driver ahci_da850_driver = {
 	.driver = {
 		.name = DRV_NAME,
 		.of_match_table = ahci_da850_of_match,
-		.pm = &ahci_da850_pm_ops,
+		.pm = pm_ptr(&ahci_da850_pm_ops),
 	},
 };
 module_platform_driver(ahci_da850_driver);
-- 
2.25.1


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

* Re: [PATCH v3] ata: ahci_da850: switch to DEFINE_SIMPLE_DEV_PM_OPS
  2026-09-08  6:10 [PATCH v3] ata: ahci_da850: switch to DEFINE_SIMPLE_DEV_PM_OPS Li Jun
@ 2026-09-08  6:13 ` Damien Le Moal
  2026-09-08  8:45   ` Niklas Cassel
  2026-09-08  6:20 ` sashiko-bot
  1 sibling, 1 reply; 5+ messages in thread
From: Damien Le Moal @ 2026-09-08  6:13 UTC (permalink / raw)
  To: Li Jun, cassel, linux-ide

On 9/8/26 15:10, Li Jun wrote:
> Replace the deprecated SIMPLE_DEV_PM_OPS macro with the recommended
> DEFINE_SIMPLE_DEV_PM_OPS. Use pm_ptr(&ahci_da850_pm_ops) to complete
> the API migration and allow the structure to be correctly dropped
> when CONFIG_PM=n.
> 
> Signed-off-by: Li Jun <lijun01@kylinos.cn>
> Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
> ---
> changelogs:
> -add pm_ptr for ahci_da850_pm_ops in ahci_da850_driver.
> -revise grammar and alignment issues.
> ---
>  drivers/ata/ahci_da850.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ata/ahci_da850.c b/drivers/ata/ahci_da850.c
> index 4e53ff96d712..469cf015bbf0 100644
> --- a/drivers/ata/ahci_da850.c
> +++ b/drivers/ata/ahci_da850.c
> @@ -218,8 +218,8 @@ static int ahci_da850_probe(struct platform_device *pdev)
>  	return rc;
>  }
>  
> -static SIMPLE_DEV_PM_OPS(ahci_da850_pm_ops, ahci_platform_suspend,
> -			 ahci_platform_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(ahci_da850_pm_ops, ahci_platform_suspend,
> +								ahci_platform_resume);

You resent the same v3... Did you mean to send a fixed v4? Or is it me for some
reason getting the same patch email twice?

>  
>  static const struct of_device_id ahci_da850_of_match[] = {
>  	{ .compatible = "ti,da850-ahci", },
> @@ -233,7 +233,7 @@ static struct platform_driver ahci_da850_driver = {
>  	.driver = {
>  		.name = DRV_NAME,
>  		.of_match_table = ahci_da850_of_match,
> -		.pm = &ahci_da850_pm_ops,
> +		.pm = pm_ptr(&ahci_da850_pm_ops),
>  	},
>  };
>  module_platform_driver(ahci_da850_driver);


-- 
Damien Le Moal
Western Digital Research

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

* Re: [PATCH v3] ata: ahci_da850: switch to DEFINE_SIMPLE_DEV_PM_OPS
  2026-09-08  6:10 [PATCH v3] ata: ahci_da850: switch to DEFINE_SIMPLE_DEV_PM_OPS Li Jun
  2026-09-08  6:13 ` Damien Le Moal
@ 2026-09-08  6:20 ` sashiko-bot
  1 sibling, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-09-08  6:20 UTC (permalink / raw)
  To: Li Jun; +Cc: dlemoal, linux-ide, cassel

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The ahci_da850 driver hooks into standard ahci_platform_resume, but fails to restore SoC-specific SATA PHY registers after suspend, causing SATA to be uninitialized on resume.
--

commit d5b66599e27a81a0e92aca89e46cdd92303b81e7
Author: Li Jun <lijun01@kylinos.cn>

ata: ahci_da850: switch to DEFINE_SIMPLE_DEV_PM_OPS

This patch replaces the deprecated SIMPLE_DEV_PM_OPS macro with the
recommended DEFINE_SIMPLE_DEV_PM_OPS. It also uses pm_ptr() to complete
the API migration and allow the pm_ops structure to be dropped when
CONFIG_PM is disabled.

> diff --git a/drivers/ata/ahci_da850.c b/drivers/ata/ahci_da850.c
> --- a/drivers/ata/ahci_da850.c
> +++ b/drivers/ata/ahci_da850.c

[ ... ]

> @@ -227,8 +227,8 @@ static int ahci_da850_probe(struct platform_device *pdev)
>  	return rc;
>  }
>  
> -static SIMPLE_DEV_PM_OPS(ahci_da850_pm_ops, ahci_platform_suspend,
> -			 ahci_platform_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(ahci_da850_pm_ops, ahci_platform_suspend,
> +								ahci_platform_resume);

[Severity: High]
This is a pre-existing issue, but by examining the PM operations being wired
here, it appears the driver hooks into the generic ahci_platform_resume
without restoring SoC-specific SATA PHY registers.

During probe in drivers/ata/ahci_da850.c, ahci_da850_probe() initializes
the SATA PHY registers by calling da850_sata_init() with local parameters.
However, the resume callback is wired directly to the generic
ahci_platform_resume, which only restores standard AHCI state and bulk
clocks. It is completely unaware of the custom DA850 PHY initialization.

Furthermore, the necessary parameters for PHY initialization (pwrdn_reg and
mpy) are local to the ahci_da850_probe() function and not saved for later
use.

Could a system suspend followed by a resume cycle leave the SATA controller
uninitialized, causing connected drives to become inaccessible?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260908061025.3580261-1-lijun01@kylinos.cn?part=1

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

* Re: [PATCH v3] ata: ahci_da850: switch to DEFINE_SIMPLE_DEV_PM_OPS
  2026-09-08  6:13 ` Damien Le Moal
@ 2026-09-08  8:45   ` Niklas Cassel
  2026-09-08  9:04     ` Damien Le Moal
  0 siblings, 1 reply; 5+ messages in thread
From: Niklas Cassel @ 2026-09-08  8:45 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: Li Jun, linux-ide

On Tue, Sep 08, 2026 at 03:13:49PM +0900, Damien Le Moal wrote:
> On 9/8/26 15:10, Li Jun wrote:
> > Replace the deprecated SIMPLE_DEV_PM_OPS macro with the recommended
> > DEFINE_SIMPLE_DEV_PM_OPS. Use pm_ptr(&ahci_da850_pm_ops) to complete
> > the API migration and allow the structure to be correctly dropped
> > when CONFIG_PM=n.
> > 
> > Signed-off-by: Li Jun <lijun01@kylinos.cn>
> > Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
> > ---
> > changelogs:
> > -add pm_ptr for ahci_da850_pm_ops in ahci_da850_driver.
> > -revise grammar and alignment issues.
> > ---
> >  drivers/ata/ahci_da850.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/ata/ahci_da850.c b/drivers/ata/ahci_da850.c
> > index 4e53ff96d712..469cf015bbf0 100644
> > --- a/drivers/ata/ahci_da850.c
> > +++ b/drivers/ata/ahci_da850.c
> > @@ -218,8 +218,8 @@ static int ahci_da850_probe(struct platform_device *pdev)
> >  	return rc;
> >  }
> >  
> > -static SIMPLE_DEV_PM_OPS(ahci_da850_pm_ops, ahci_platform_suspend,
> > -			 ahci_platform_resume);
> > +static DEFINE_SIMPLE_DEV_PM_OPS(ahci_da850_pm_ops, ahci_platform_suspend,
> > +								ahci_platform_resume);
> 
> You resent the same v3... Did you mean to send a fixed v4? Or is it me for some
> reason getting the same patch email twice?

I just received a single v2 and a single v3.

The commit log is different from v2 and v3, and your Review-tag was picked
up. However, the indentation still looks wrong. It seems to have 8 tabs
instead of 4.


Kind regards,
Niklas

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

* Re: [PATCH v3] ata: ahci_da850: switch to DEFINE_SIMPLE_DEV_PM_OPS
  2026-09-08  8:45   ` Niklas Cassel
@ 2026-09-08  9:04     ` Damien Le Moal
  0 siblings, 0 replies; 5+ messages in thread
From: Damien Le Moal @ 2026-09-08  9:04 UTC (permalink / raw)
  To: Niklas Cassel; +Cc: Li Jun, linux-ide

On 9/8/26 17:45, Niklas Cassel wrote:
> On Tue, Sep 08, 2026 at 03:13:49PM +0900, Damien Le Moal wrote:
>> On 9/8/26 15:10, Li Jun wrote:
>>> Replace the deprecated SIMPLE_DEV_PM_OPS macro with the recommended
>>> DEFINE_SIMPLE_DEV_PM_OPS. Use pm_ptr(&ahci_da850_pm_ops) to complete
>>> the API migration and allow the structure to be correctly dropped
>>> when CONFIG_PM=n.
>>>
>>> Signed-off-by: Li Jun <lijun01@kylinos.cn>
>>> Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
>>> ---
>>> changelogs:
>>> -add pm_ptr for ahci_da850_pm_ops in ahci_da850_driver.
>>> -revise grammar and alignment issues.
>>> ---
>>>  drivers/ata/ahci_da850.c | 6 +++---
>>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/ata/ahci_da850.c b/drivers/ata/ahci_da850.c
>>> index 4e53ff96d712..469cf015bbf0 100644
>>> --- a/drivers/ata/ahci_da850.c
>>> +++ b/drivers/ata/ahci_da850.c
>>> @@ -218,8 +218,8 @@ static int ahci_da850_probe(struct platform_device *pdev)
>>>  	return rc;
>>>  }
>>>  
>>> -static SIMPLE_DEV_PM_OPS(ahci_da850_pm_ops, ahci_platform_suspend,
>>> -			 ahci_platform_resume);
>>> +static DEFINE_SIMPLE_DEV_PM_OPS(ahci_da850_pm_ops, ahci_platform_suspend,
>>> +								ahci_platform_resume);
>>
>> You resent the same v3... Did you mean to send a fixed v4? Or is it me for some
>> reason getting the same patch email twice?
> 
> I just received a single v2 and a single v3.

Indeed, I missed v3 in the email subject.

> 
> The commit log is different from v2 and v3, and your Review-tag was picked
> up. However, the indentation still looks wrong. It seems to have 8 tabs
> instead of 4.

And yes, the indentation is still wrong.
Maybe fix it when applying?

> 
> 
> Kind regards,
> Niklas


-- 
Damien Le Moal
Western Digital Research

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

end of thread, other threads:[~2026-09-08  9:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-08  6:10 [PATCH v3] ata: ahci_da850: switch to DEFINE_SIMPLE_DEV_PM_OPS Li Jun
2026-09-08  6:13 ` Damien Le Moal
2026-09-08  8:45   ` Niklas Cassel
2026-09-08  9:04     ` Damien Le Moal
2026-09-08  6:20 ` sashiko-bot

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.