r8169: use pci_prepare_to_sleep in rtl_shutdown
Heiner Kallweit
maintainerPATCH 1/1 r8169: use pci_prepare_to_sleep in rtl_shutdown
Use pci_prepare_to_sleep() like PCI core does in pci_pm_suspend_noirq. This aligns setting a low-power mode during shutdown with the handling of the transition to system suspend. Also the transition to runtime suspend uses pci_target_state() instead of setting D3hot unconditionally.
Note: pci_prepare_to_sleep() uses device_may_wakeup() to check whether
device may generate wakeup events. So we don't lose anything by not passing tp->saved_wolopts any longer.
--- drivers/net/ethernet/realtek/r8169_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/realtek/r8169_main.c +2 -4
@@ -5028,10 +5028,8 @@ static void rtl_shutdown(struct pci_dev *pdev)/* Restore original MAC address */ rtl_rar_set (tp, tp->dev->perm_addr); -if (system_state ==SYSTEM_POWER_OFF && !tp->dash_enabled) { -pci_wake_from_d3 (pdev, tp->saved_wolopts); -pci_set_power_state (pdev, PCI_D3hot); - } +if (system_state ==SYSTEM_POWER_OFF && !tp->dash_enabled) +pci_prepare_to_sleep (pdev); }static void rtl_remove_one (struct pci_dev *pdev)
Signature · 1 line
2.49.0
Quoted 11 lines · Heiner Kallweit
Use
pci_prepare_to_sleep()like PCI core does inpci_pm_suspend_noirq. This aligns setting a low-power mode during shutdown with the handling of the transition to system suspend. Also the transition to runtime suspend usespci_target_state()instead of setting D3hot unconditionally.Note:
pci_prepare_to_sleep()usesdevice_may_wakeup()to check whether
device may generate wakeup events. So we don't lose anything by not passingtp->saved_woloptsany longer.Signed-off-by Heiner Kallweit <[email protected]>---
Quoted 20 lines
drivers/net/ethernet/realtek/r8169_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/net/ethernet/realtek/r8169_main.c +2
-4@@ -5028,10 +5028,8 @@ static void rtl_shutdown(struct pci_dev *pdev)/* Restore original MAC address */ rtl_rar_set (tp, tp->dev->perm_addr); -if (system_state ==SYSTEM_POWER_OFF && !tp->dash_enabled) { -pci_wake_from_d3 (pdev, tp->saved_wolopts); -pci_set_power_state (pdev, PCI_D3hot); - } +if (system_state ==SYSTEM_POWER_OFF && !tp->dash_enabled) +pci_prepare_to_sleep (pdev); }static void rtl_remove_one (struct pci_dev *pdev)
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Mon, 21 Apr 2025 11:25:18 +0200 you wrote:
Use
pci_prepare_to_sleep()like PCI core does inpci_pm_suspend_noirq. This aligns setting a low-power mode during shutdown with the handling of the transition to system suspend. Also the transition to runtime suspend usespci_target_state()instead of setting D3hot unconditionally.Note:
pci_prepare_to_sleep()usesdevice_may_wakeup()to check whether
device may generate wakeup events. So we don't lose anything by not passingtp->saved_woloptsany longer.[...]
Here is the summary with links:
- [net-next] r8169: use pci_prepare_to_sleep in rtl_shutdown
https://git.kernel.org/netdev/net-next/c/b7ed5d5a78fc
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html