igb: fix unused igb_deliver_wake_packet() warning when CONFIG_PM=n
Subsystems (3)
PATCH 1/1 igb: fix unused igb_deliver_wake_packet() warning when CONFIG_PM=n
From: Dave Hansen <[email protected]>
I'm seeing warnings on kernel configurations where CONFIG_PM is disabled. It happens in 4.12, at least:
drivers/ethernet/intel/igb/igb_main.c:7988:13: warning: 'igb_deliver_wake_packet' defined but not used [-Wunused-function]
This is because igb_deliver_wake_packet() is defined outside of the #ifdef", but is used only a single time within the #ifdef in igb_resume(). Fix it by moving igb_deliver_wake_packet() next to igb_resume() inside the #ifdef.
The diff ends up looking a bit funky here. It *looks* like igb_suspend() is getting moved, but that's an artifact of how 'diff' sees the changes.
---
b/drivers/net/ethernet/intel/igb/igb_main.c | 46 ++++++++++++++-------------- 1 file changed, 23 insertions(+), 23 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c renamed from drivers/net/ethernet/intel/igb/igb_main.c~undef-igb_deliver_wake_packet +23 -23
@@ -7985,6 +7985,29 @@ static int __igb_shutdown(struct pci_devreturn 0 ; } +#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP +static int igb_suspend (struct device *dev) +{ +int retval; +bool wake; +struct pci_dev *pdev =to_pci_dev (dev); + + retval =__igb_shutdown (pdev, &wake,0 ); +if (retval) +return retval; + +if (wake) { +pci_prepare_to_sleep (pdev); + }else { +pci_wake_from_d3 (pdev, false); +pci_set_power_state (pdev, PCI_D3hot); + } + +return 0 ; +} +#endif /* CONFIG_PM_SLEEP */ +static void igb_deliver_wake_packet (struct net_device *netdev) {struct igb_adapter *adapter =netdev_priv (netdev);
@@ -8015,29 +8038,6 @@ static void igb_deliver_wake_packet(strunetif_rx (skb); } -#ifdef CONFIG_PM -#ifdef CONFIG_PM_SLEEP -static int igb_suspend (struct device *dev) -{ -int retval; -bool wake; -struct pci_dev *pdev =to_pci_dev (dev); - - retval =__igb_shutdown (pdev, &wake,0 ); -if (retval) -return retval; - -if (wake) { -pci_prepare_to_sleep (pdev); - }else { -pci_wake_from_d3 (pdev, false); -pci_set_power_state (pdev, PCI_D3hot); - } - -return 0 ; -} -#endif /* CONFIG_PM_SLEEP */ -static int igb_resume (struct device *dev) {struct pci_dev *pdev =to_pci_dev (dev);
_
Quoted 13 lines · Dave Hansen
From: Dave Hansen <[email protected]>
I'm seeing warnings on kernel configurations where
CONFIG_PMis disabled. It happens in 4.12, at least:
drivers/ethernet/intel/igb/igb_main.c:7988:13: warning: 'igb_deliver_wake_packet' defined but not used [-Wunused-function]This is because
igb_deliver_wake_packet()is defined outside of the #ifdef", but is used only a single time within the #ifdef inigb_resume(). Fix it by movingigb_deliver_wake_packet()next toigb_resume()inside the #ifdef.
Quoted 8 lines
The diff ends up looking a bit funky here. It *looks* like
igb_suspend()is getting moved, but that's an artifact of how 'diff' sees the changes.Cc Jeff Kirsher <[email protected]>Cc intel-wired-lan at lists.osuosl.orgCc netdev at vger.kernel.orgSigned-off-by Dave Hansen <[email protected]>
Seems to be fixed by the following commit in linux-next:
commit 000ba1f2ebf0d6f93b9ae6cfbe5417e66f1b8e8c
Author: Arnd Bergmann <[email protected]> Date: Thu Apr 27 21:09:52 2017 +0200
igb: mark PM functions as __maybe_unused
The new wake function is only used by the suspend/resume handlers that are defined in inside of an #ifdef, which can cause this harmless warning:
drivers/net/ethernet/intel/igb/igb_main.c:7988:13: warning:
'igb_deliver_wake_packet' defined but not used [-Wunused-function]
Removing the #ifdef, instead using a __maybe_unused annotation simplifies the code and avoids the warning.
Quoted 41 lines · Fabio Estevam
Quoted 14 lines · Dave Hansen
From: Dave Hansen <[email protected]>
I'm seeing warnings on kernel configurations where
CONFIG_PMis disabled. It happens in 4.12, at least:
drivers/ethernet/intel/igb/igb_main.c:7988:13: warning:
'igb_deliver_wake_packet' defined but not used [-Wunused-function]This is because
igb_deliver_wake_packet()is defined outside of the #ifdef", but is used only a single time within the #ifdef inigb_resume(). Fix it by movingigb_deliver_wake_packet()next toigb_resume()inside the #ifdef.Quoted 8 lines
The diff ends up looking a bit funky here. It *looks* like
igb_suspend()is getting moved, but that's an artifact of how 'diff' sees the changes.Cc Jeff Kirsher <[email protected]>Cc intel-wired-lan at lists.osuosl.orgCc netdev at vger.kernel.orgSigned-off-by Dave Hansen <[email protected]>Seems to be fixed by the following commit in linux-next:
commit
000ba1f2ebf0d6f93b9ae6cfbe5417e66f1b8e8cAuthor: Arnd Bergmann <[email protected]> Date: Thu Apr 27 21:09:52 2017 +0200igb: mark PM functions as
__maybe_unusedThe new wake function is only used by the suspend/resume handlers
that
are defined in inside of an #ifdef, which can cause this harmless warning:
drivers/net/ethernet/intel/igb/igb_main.c:7988:13: warning:
'igb_deliver_wake_packet' defined but not used [-Wunused-function]
Quoted 7 lines
Removing the #ifdef, instead using a
__maybe_unusedannotation simplifies the code and avoids the warning.Fixes b90fa8763560 ("igb: Enable reading of wake up packet")Signed-off-by Arnd Bergmann <[email protected]>Tested-by Aaron Brown <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Yeah, this is already fixed in my tree. Dropping this patch.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20170713/d6cbf4a1/attachment.asc>
David Miller
maintainerFrom: Dave Hansen <[email protected]>
Date: Wed, 12 Jul 2017 14:09:25 -0700
Quoted 13 lines
From: Dave Hansen <[email protected]>
I'm seeing warnings on kernel configurations where
CONFIG_PMis disabled. It happens in 4.12, at least:
drivers/ethernet/intel/igb/igb_main.c:7988:13: warning: 'igb_deliver_wake_packet' defined but not used [-Wunused-function]This is because
igb_deliver_wake_packet()is defined outside of the #ifdef", but is used only a single time within the #ifdef inigb_resume(). Fix it by movingigb_deliver_wake_packet()next toigb_resume()inside the #ifdef.
Quoted 8 lines
The diff ends up looking a bit funky here. It *looks* like
igb_suspend()is getting moved, but that's an artifact of how 'diff' sees the changes.Cc Jeff Kirsher <[email protected]>Cc intel-wired-lan at lists.osuosl.orgCc netdev at vger.kernel.orgSigned-off-by Dave Hansen <[email protected]>
I'll let Jeff queue this up into his tree.