2023-04-28 20:55:45

by Tom Rix

[permalink] [raw]
Subject: [PATCH] igb: Define igb_pm_ops conditionally on CONFIG_PM

For s390, gcc with W=1 reports
drivers/net/ethernet/intel/igb/igb_main.c:186:32: error:
'igb_pm_ops' defined but not used [-Werror=unused-const-variable=]
186 | static const struct dev_pm_ops igb_pm_ops = {
| ^~~~~~~~~~

The only use of igb_pm_ops is conditional on CONFIG_PM.
The definition of igb_pm_ops should also be conditional on CONFIG_PM

Signed-off-by: Tom Rix <[email protected]>
---
drivers/net/ethernet/intel/igb/igb_main.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 58872a4c2540..c5cdb880774d 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -183,11 +183,13 @@ static int igb_resume(struct device *);
static int igb_runtime_suspend(struct device *dev);
static int igb_runtime_resume(struct device *dev);
static int igb_runtime_idle(struct device *dev);
+#ifdef CONFIG_PM
static const struct dev_pm_ops igb_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(igb_suspend, igb_resume)
SET_RUNTIME_PM_OPS(igb_runtime_suspend, igb_runtime_resume,
igb_runtime_idle)
};
+#endif
static void igb_shutdown(struct pci_dev *);
static int igb_pci_sriov_configure(struct pci_dev *dev, int num_vfs);
#ifdef CONFIG_IGB_DCA
--
2.27.0


2023-05-02 11:29:45

by Simon Horman

[permalink] [raw]
Subject: Re: [PATCH] igb: Define igb_pm_ops conditionally on CONFIG_PM

On Fri, Apr 28, 2023 at 04:00:09PM -0400, Tom Rix wrote:
> For s390, gcc with W=1 reports
> drivers/net/ethernet/intel/igb/igb_main.c:186:32: error:
> 'igb_pm_ops' defined but not used [-Werror=unused-const-variable=]
> 186 | static const struct dev_pm_ops igb_pm_ops = {
> | ^~~~~~~~~~
>
> The only use of igb_pm_ops is conditional on CONFIG_PM.
> The definition of igb_pm_ops should also be conditional on CONFIG_PM
>
> Signed-off-by: Tom Rix <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

2023-05-03 09:08:44

by Pucha, HimasekharX Reddy

[permalink] [raw]
Subject: RE: [Intel-wired-lan] [PATCH] igb: Define igb_pm_ops conditionally on CONFIG_PM

> -----Original Message-----
> From: Intel-wired-lan <[email protected]> On Behalf Of Rix, Tom
> Sent: Saturday, April 29, 2023 1:30 AM
> To: Brandeburg, Jesse <[email protected]>; Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
> Cc: [email protected]; [email protected]; [email protected]; Rix, Tom <[email protected]>
> Subject: [Intel-wired-lan] [PATCH] igb: Define igb_pm_ops conditionally on CONFIG_PM
>
> For s390, gcc with W=1 reports
> drivers/net/ethernet/intel/igb/igb_main.c:186:32: error:
> 'igb_pm_ops' defined but not used [-Werror=unused-const-variable=]
> 186 | static const struct dev_pm_ops igb_pm_ops = {
> | ^~~~~~~~~~
>
> The only use of igb_pm_ops is conditional on CONFIG_PM.
> The definition of igb_pm_ops should also be conditional on CONFIG_PM
>
> Signed-off-by: Tom Rix <[email protected]>
> ---
> drivers/net/ethernet/intel/igb/igb_main.c | 2 ++
> 1 file changed, 2 insertions(+)
>

Tested-by: Pucha Himasekhar Reddy <[email protected]> (A Contingent worker at Intel)