pci: dwc: dra7xx: Add shutdown handler to cleanly turn off clocks
PATCH 1/1 pci: dwc: dra7xx: Add shutdown handler to cleanly turn off clocks
Add shutdown handler to cleanly turn off clocks.
--- drivers/pci/dwc/pci-dra7xx.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/pci/dwc/pci-dra7xx.c +14 -0
@@ -874,6 +874,19 @@ static int dra7xx_pcie_suspend_noirq(struct device *dev)return 0 ; } +void dra7xx_pcie_shutdown (struct platform_device *pdev) +{ +struct dra7xx_pcie *dra7xx =dev_get_drvdata (&pdev->dev); +int ret; + + ret =pm_runtime_put_sync (&pdev->dev); +if (ret <0 ) +dev_dbg (&pdev->dev,"pm_runtime_put_sync failed\n" ); + +pm_runtime_disable (&pdev->dev); +dra7xx_pcie_disable_phy (dra7xx); +} +static int dra7xx_pcie_resume_noirq (struct device *dev) {struct dra7xx_pcie *dra7xx =dev_get_drvdata (dev);
@@ -902,5 +915,6 @@ static int dra7xx_pcie_resume_noirq(struct device *dev) .suppress_bind_attrs = true, .pm = &dra7xx_pcie_pm_ops, }, + .shutdown = dra7xx_pcie_shutdown, };builtin_platform_driver_probe (dra7xx_pcie_driver, dra7xx_pcie_probe);
Signature · 1 line
1.9.1
Keerthy,
Quoted 1 line · Keerthy
Add shutdown handler to cleanly turn off clocks.
one minor comment below.. with that fixed you can add my
Quoted 11 lines
Signed-off-by Keerthy <[email protected]>--- drivers/pci/dwc/pci-dra7xx.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)drivers/pci/dwc/pci-dra7xx.c +0
-0
drivers/pci/dwc/pci-dra7xx.c static int dra7xx_pcie_suspend_noirq(struct device *dev) · line 879
Quoted 6 lines
drivers/pci/dwc/pci-dra7xx.c +3
-0@@ -874,6 +874,19 @@ static int dra7xx_pcie_suspend_noirq(struct device *dev)return 0 ; } +void dra7xx_pcie_shutdown (struct platform_device *pdev) +{ +struct dra7xx_pcie *dra7xx =dev_get_drvdata (&pdev->dev);
Use struct device *dev = &pdev->dev, instead of de-referencing device pointer multiple times.
Thanks
Kishon
Quoted 22 lines · Kishon Vijay Abraham I
Keerthy,
Quoted 1 line · Keerthy
Add shutdown handler to cleanly turn off clocks.
one minor comment below.. with that fixed you can add my
Quoted 14 lines
Signed-off-by Keerthy <[email protected]>--- drivers/pci/dwc/pci-dra7xx.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)drivers/pci/dwc/pci-dra7xx.c +0
-0@@ -874,6 +874,19 @@ static int dra7xx_pcie_suspend_noirq(struct device *dev)return 0 ; }
Quoted 6 lines
drivers/pci/dwc/pci-dra7xx.c static int dra7xx_pcie_suspend_noirq(struct device *dev) · line 879
Quoted 3 lines
drivers/pci/dwc/pci-dra7xx.c +3
-0+void dra7xx_pcie_shutdown (struct platform_device *pdev) +{ +struct dra7xx_pcie *dra7xx =dev_get_drvdata (&pdev->dev);Use struct device *dev =
&pdev->dev, instead of de-referencing device pointer multiple times.
You might also have to dra7xx_pcie_stop_link() before disabling the clocks.
Thanks
Kishon
Quoted 25 lines · Kishon Vijay Abraham I
Quoted 22 lines · Kishon Vijay Abraham I
Keerthy,
Quoted 1 line · Keerthy
Add shutdown handler to cleanly turn off clocks.
one minor comment below.. with that fixed you can add my
Quoted 14 lines
Signed-off-by Keerthy <[email protected]>--- drivers/pci/dwc/pci-dra7xx.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)drivers/pci/dwc/pci-dra7xx.c +0
-0@@ -874,6 +874,19 @@ static int dra7xx_pcie_suspend_noirq(struct device *dev)return 0 ; }
Quoted 8 lines
Quoted 6 lines
drivers/pci/dwc/pci-dra7xx.c static int dra7xx_pcie_suspend_noirq(struct device *dev) · line 879
Quoted 3 lines
drivers/pci/dwc/pci-dra7xx.c +3
-0+void dra7xx_pcie_shutdown (struct platform_device *pdev) +{ +struct dra7xx_pcie *dra7xx =dev_get_drvdata (&pdev->dev);Use struct device *dev =
&pdev->dev, instead of de-referencing device pointer multiple times.You might also have to
dra7xx_pcie_stop_link()before disabling the clocks.
Thanks for the quick review. I will incorporate the above comments and post v2.
Regards,
Keerthy
Quoted 4 lines
Thanks
Kishon