Skip to contentSkip to conversation

atl1: Protect atl1_suspend with CONFIG_PM_SLEEP

PATCH Applied Fabio Estevam 3 participants 3 messages Apr 16, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 atl1: Protect atl1_suspend with CONFIG_PM_SLEEP

From: Fabio Estevam <[email protected]>

commit 7b7a2bbb690 (atl1: Remove unneeded PM_OPS definitions) removed the definition of atl1_suspend for the !CONFIG_PM_SLEEP case.

So only call atl1_suspend() when CONFIG_PM_SLEEP is defined and fix the following build error from randconfig:

drivers/net/ethernet/atheros/atlx/atl1.c: In function 'atl1_shutdown':
drivers/net/ethernet/atheros/atlx/atl1.c:2888:2: error: implicit declaration of function 'atl1_suspend' [-Werror=implicit-function-declaration]

---
 drivers/net/ethernet/atheros/atlx/atl1.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/atheros/atlx/atl1.c +2 -0
index 9843c70..8338013 100644
@@ -2885,7 +2885,9 @@ static void atl1_shutdown(struct pci_dev *pdev)
 	struct net_device *netdev = pci_get_drvdata(pdev);
 	struct atl1_adapter *adapter = netdev_priv(netdev);
 
+#ifdef CONFIG_PM_SLEEP
 	atl1_suspend(&pdev->dev);
+#endif
 	pci_wake_from_d3(pdev, adapter->wol);
 	pci_set_power_state(pdev, PCI_D3hot);
 }
Signature · 1 line
1.7.9.5
#1 lore raw

Hello.

Quoted 22 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

commit 7b7a2bbb690 (atl1: Remove unneeded PM_OPS definitions) removed the definition of atl1_suspend for the !CONFIG_PM_SLEEP case.

So only call atl1_suspend() when CONFIG_PM_SLEEP is defined and fix the following build error from randconfig:

drivers/net/ethernet/atheros/atlx/atl1.c: In function 'atl1_shutdown':
drivers/net/ethernet/atheros/atlx/atl1.c:2888:2: error: implicit declaration of function 'atl1_suspend' [-Werror=implicit-function-declaration]

---
  drivers/net/ethernet/atheros/atlx/atl1.c |    2 ++
  1 file changed, 2 insertions(+)
drivers/net/ethernet/atheros/atlx/atl1.c +0 -0
index 9843c70..8338013 100644

drivers/net/ethernet/atheros/atlx/atl1.c static void atl1_shutdown(struct pci_dev *pdev) · line 2890

Quoted 6 lines
drivers/net/ethernet/atheros/atlx/atl1.c +2 -0
@@ -2885,7 +2885,9 @@ static void atl1_shutdown(struct pci_dev *pdev)
  	struct net_device *netdev = pci_get_drvdata(pdev);
  	struct atl1_adapter *adapter = netdev_priv(netdev);
 
+#ifdef CONFIG_PM_SLEEP
  	atl1_suspend(&pdev->dev);
+#endif

This is not the best practice as #ifdef's in the function bodies are
not encouraged.
Better enclose

atl1_suspend() in #ifdef CONFIG_PM_SLEEP
and define it as an empty static inline function in the #else clause.

WBR, Sergei

maintainer Applied
#2 lore raw
In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>
Date: Tue, 16 Apr 2013 18:35:00 -0300

Quoted 5 lines

From: Fabio Estevam <[email protected]>

commit 7b7a2bbb690 (atl1: Remove unneeded PM_OPS definitions) removed the definition of atl1_suspend for the !CONFIG_PM_SLEEP case.

Quoted 8 lines

So only call atl1_suspend() when CONFIG_PM_SLEEP is defined and fix the following build error from randconfig:

drivers/net/ethernet/atheros/atlx/atl1.c: In function 'atl1_shutdown':
drivers/net/ethernet/atheros/atlx/atl1.c:2888:2: error: implicit declaration of function 'atl1_suspend' [-Werror=implicit-function-declaration]

Applied, thanks.