Skip to contentSkip to conversation

fm10k: mark PM functions as __maybe_unused

PATCH In review Arnd Bergmann 3 participants 3 messages Oct 11, 2017 – Nov 28, 2017

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

PATCH 1/1 fm10k: mark PM functions as __maybe_unused

A cleanup of the PM code left an incorrect #ifdef in place, leading to a harmless build warning:

drivers/net/ethernet/intel/fm10k/fm10k_pci.c:2502:12: error: 'fm10k_suspend' defined but not used [-Werror=unused-function] drivers/net/ethernet/intel/fm10k/fm10k_pci.c:2475:12: error: 'fm10k_resume' defined but not used [-Werror=unused-function]

It's easier to use __maybe_unused attributes here, since you can't pick the wrong one.

Fixes 8249c47c6ba4 ("fm10k: use generic PM hooks instead of legacy PCIe power hooks")
---
 drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_pci.c +2 -7
index 1e9ae3197b17..52f8eb3c470e 100644
@@ -2463,7 +2463,6 @@ static int fm10k_handle_resume(struct fm10k_intfc *interface)
 	return err;
 }
 
-#ifdef CONFIG_PM
 /**
  * fm10k_resume - Generic PM resume hook
  * @dev: generic device structure
@@ -2472,7 +2471,7 @@ static int fm10k_handle_resume(struct fm10k_intfc *interface)
  * suspend or hibernation. This function does not need to handle lower PCIe
  * device state as the stack takes care of that for us.
  **/
-static int fm10k_resume(struct device *dev)
+static int __maybe_unused fm10k_resume(struct device *dev)
 {
 	struct fm10k_intfc *interface = pci_get_drvdata(to_pci_dev(dev));
 	struct net_device *netdev = interface->netdev;
@@ -2499,7 +2498,7 @@ static int fm10k_resume(struct device *dev)
  * system suspend or hibernation. This function does not need to handle lower
  * PCIe device state as the stack takes care of that for us.
  **/
-static int fm10k_suspend(struct device *dev)
+static int __maybe_unused fm10k_suspend(struct device *dev)
 {
 	struct fm10k_intfc *interface = pci_get_drvdata(to_pci_dev(dev));
 	struct net_device *netdev = interface->netdev;
@@ -2511,8 +2510,6 @@ static int fm10k_suspend(struct device *dev)
 	return 0;
 }
 
-#endif /* CONFIG_PM */
-
 /**
  * fm10k_io_error_detected - called when PCI error is detected
  * @pdev: Pointer to PCI device
@@ -2643,11 +2640,9 @@ static struct pci_driver fm10k_driver = {
 	.id_table		= fm10k_pci_tbl,
 	.probe			= fm10k_probe,
 	.remove			= fm10k_remove,
-#ifdef CONFIG_PM
 	.driver = {
 		.pm		= &fm10k_pm_ops,
 	},
-#endif /* CONFIG_PM */
 	.sriov_configure	= fm10k_iov_configure,
 	.err_handler		= &fm10k_err_handler
 };
Signature · 1 line
2.9.0
Acked-by on v1 1/1
#1 lore raw
Quoted 16 lines

-----Original Message-----
From: Arnd Bergmann [mailto:arnd at arndb.de]
Sent: Wednesday, October 11, 2017 6:58 AM
To: Kirsher, Jeffrey T <[email protected]>
Cc: Arnd Bergmann <[email protected]>; Keller, Jacob E <[email protected]>; Kwan, Ngai-mint <[email protected]>; David S. Miller <[email protected]>; Florian Westphal <[email protected]>; intel-wired-lan at lists.osuosl.org; netdev at vger.kernel.org; linux- kernel at vger.kernel.org
Subject: [PATCH] fm10k: mark PM functions as __maybe_unused

A cleanup of the PM code left an incorrect #ifdef in place, leading to a harmless build warning:

Quoted 8 lines

drivers/net/ethernet/intel/fm10k/fm10k_pci.c:2502:12: error: 'fm10k_suspend' defined but not used [-Werror=unused-function] drivers/net/ethernet/intel/fm10k/fm10k_pci.c:2475:12: error: 'fm10k_resume' defined but not used [-Werror=unused-function]

It's easier to use __maybe_unused attributes here, since you can't pick the wrong one.

Quoted 63 lines
Fixes 8249c47c6ba4 ("fm10k: use generic PM hooks instead of legacy PCIe power

hooks")

---
 drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_pci.c +0 -1
index 1e9ae3197b17..52f8eb3c470e 100644
@@ -2463,7 +2463,6 @@ static int fm10k_handle_resume(struct fm10k_intfc
 *interface)
 	return err;
 }
 
-#ifdef CONFIG_PM
 /**
  * fm10k_resume - Generic PM resume hook

* @dev: generic device structure

drivers/net/ethernet/intel/fm10k/fm10k_pci.c +1 -1
@@ -2472,7 +2471,7 @@ static int fm10k_handle_resume(struct fm10k_intfc
 *interface)
  * suspend or hibernation. This function does not need to handle lower PCIe
  * device state as the stack takes care of that for us.
  **/
-static int fm10k_resume(struct device *dev)
+static int __maybe_unused fm10k_resume(struct device *dev)
 {
 	struct fm10k_intfc *interface = pci_get_drvdata(to_pci_dev(dev));
drivers/net/ethernet/intel/fm10k/fm10k_pci.c +1 -6
 	struct net_device *netdev = interface->netdev;
@@ -2499,7 +2498,7 @@ static int fm10k_resume(struct device *dev)
  * system suspend or hibernation. This function does not need to handle lower
  * PCIe device state as the stack takes care of that for us.
  **/
-static int fm10k_suspend(struct device *dev)
+static int __maybe_unused fm10k_suspend(struct device *dev)
 {
 	struct fm10k_intfc *interface = pci_get_drvdata(to_pci_dev(dev));
 	struct net_device *netdev = interface->netdev;
@@ -2511,8 +2510,6 @@ static int fm10k_suspend(struct device *dev)
 	return 0;
 }
 
-#endif /* CONFIG_PM */
-
 /**
  * fm10k_io_error_detected - called when PCI error is detected
  * @pdev: Pointer to PCI device
@@ -2643,11 +2640,9 @@ static struct pci_driver fm10k_driver = {
 	.id_table		= fm10k_pci_tbl,
 	.probe			= fm10k_probe,
 	.remove			= fm10k_remove,
-#ifdef CONFIG_PM
 	.driver = {
 		.pm		= &fm10k_pm_ops,
 	},
-#endif /* CONFIG_PM */
 	.sriov_configure	= fm10k_iov_configure,
 	.err_handler		= &fm10k_err_handler
 };
--

2.9.0

#2 lore raw
Quoted 105 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Keller, Jacob E
Sent: Wednesday, October 11, 2017 3:20 PM
To: Arnd Bergmann <[email protected]>; Kirsher, Jeffrey T <[email protected]>
Cc: Kwan, Ngai-mint <[email protected]>; netdev at vger.kernel.org; Florian Westphal <[email protected]>; linux-kernel at vger.kernel.org; intel-wired- lan at lists.osuosl.org; David S. Miller <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH] fm10k: mark PM functions as __maybe_unused

Quoted 11 lines

-----Original Message-----
From: Arnd Bergmann [mailto:arnd at arndb.de]
Sent: Wednesday, October 11, 2017 6:58 AM
To: Kirsher, Jeffrey T <[email protected]>
Cc: Arnd Bergmann <[email protected]>; Keller, Jacob E <[email protected]>; Kwan, Ngai-mint <[email protected]>; David S. Miller <[email protected]>; Florian Westphal <[email protected]>; intel-wired-lan at lists.osuosl.org; netdev at vger.kernel.org; linux- kernel at vger.kernel.org
Subject: [PATCH] fm10k: mark PM functions as __maybe_unused

Quoted 4 lines

A cleanup of the PM code left an incorrect #ifdef in place, leading to a harmless build warning:

drivers/net/ethernet/intel/fm10k/fm10k_pci.c:2502:12: error:

'fm10k_suspend'

Quoted 2 lines

defined but not used [-Werror=unused-function] drivers/net/ethernet/intel/fm10k/fm10k_pci.c:2475:12: error:

'fm10k_resume'

Quoted 5 lines

defined but not used [-Werror=unused-function]

It's easier to use __maybe_unused attributes here, since you can't pick the wrong one.

Quoted 1 line
Fixes 8249c47c6ba4 ("fm10k: use generic PM hooks instead of legacy PCIe

power

Quoted 31 lines

hooks")

---
 drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_pci.c +0 -1
index 1e9ae3197b17..52f8eb3c470e 100644
@@ -2463,7 +2463,6 @@ static int fm10k_handle_resume(struct fm10k_intfc
 *interface)
 	return err;
 }
 
-#ifdef CONFIG_PM
 /**
  * fm10k_resume - Generic PM resume hook

* @dev: generic device structure

drivers/net/ethernet/intel/fm10k/fm10k_pci.c +1 -1
@@ -2472,7 +2471,7 @@ static int fm10k_handle_resume(struct fm10k_intfc
 *interface)
  * suspend or hibernation. This function does not need to handle lower PCIe
  * device state as the stack takes care of that for us.
  **/
-static int fm10k_resume(struct device *dev)
+static int __maybe_unused fm10k_resume(struct device *dev)
 {
 	struct fm10k_intfc *interface = pci_get_drvdata(to_pci_dev(dev));
drivers/net/ethernet/intel/fm10k/fm10k_pci.c +0 -0
 	struct net_device *netdev = interface->netdev;

drivers/net/ethernet/intel/fm10k/fm10k_pci.c static int fm10k_resume(struct device *dev) · line 2498

Quoted 1 line
drivers/net/ethernet/intel/fm10k/fm10k_pci.c +0 -0
@@ -2499,7 +2498,7 @@ static int fm10k_resume(struct device *dev)
  * system suspend or hibernation. This function does not need to handle

lower

Quoted 27 lines
drivers/net/ethernet/intel/fm10k/fm10k_pci.c +1 -5
  * PCIe device state as the stack takes care of that for us.
  **/
-static int fm10k_suspend(struct device *dev)
+static int __maybe_unused fm10k_suspend(struct device *dev)
 {
 	struct fm10k_intfc *interface = pci_get_drvdata(to_pci_dev(dev));
 	struct net_device *netdev = interface->netdev;
@@ -2511,8 +2510,6 @@ static int fm10k_suspend(struct device *dev)
 	return 0;
 }
 
-#endif /* CONFIG_PM */
-
 /**
  * fm10k_io_error_detected - called when PCI error is detected
  * @pdev: Pointer to PCI device
@@ -2643,11 +2640,9 @@ static struct pci_driver fm10k_driver = {
 	.id_table		= fm10k_pci_tbl,
 	.probe			= fm10k_probe,
 	.remove			= fm10k_remove,
-#ifdef CONFIG_PM
 	.driver = {
 		.pm		= &fm10k_pm_ops,
 	},
-#endif /* CONFIG_PM */
 	.sriov_configure	= fm10k_iov_configure,
 	.err_handler		= &fm10k_err_handler
Quoted 8 lines
Quoted 3 lines
drivers/net/ethernet/intel/fm10k/fm10k_pci.c +0 -1
 };
--

2.9.0

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan