Message ID | 20210315190231.3302869-2-anthony.l.nguyen@intel.com |
---|---|
State | Superseded |
Headers | show |
Series | 1GbE Intel Wired LAN Driver Updates 2021-03-15 | expand |
On Mon, 15 Mar 2021 12:02:30 -0700 Tony Nguyen wrote: > +static __maybe_unused int e1000e_pm_prepare(struct device *dev) > +{ > + return pm_runtime_suspended(dev) && > + pm_suspend_via_firmware(); nit: I don't think you need to mark functions called by __maybe_unused as __maybe_unused, do you? The series LGTM although I don't know much about PM.
Hi Jakub, thanks for taking a look! On Mon, Mar 15, 2021 at 02:04:22PM -0700, Jakub Kicinski wrote: > On Mon, 15 Mar 2021 12:02:30 -0700 Tony Nguyen wrote: > > +static __maybe_unused int e1000e_pm_prepare(struct device *dev) > > +{ > > + return pm_runtime_suspended(dev) && > > + pm_suspend_via_firmware(); > > nit: I don't think you need to mark functions called by __maybe_unused > as __maybe_unused, do you? > Not sure which function do you refer to having the __maybe_unused attribute and invokes this e1000e_pm_prepare()? I copied the definition from e1000e_pm_suspend() that if CONFIG_PM_SLEEP is not set, we might get compile error of such PM hooks in this driver. > The series LGTM although I don't know much about PM. Thanks! Best, Chenyu
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index e9b82c209c2d..8cd1b3e9e514 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -25,6 +25,7 @@ #include <linux/pm_runtime.h> #include <linux/aer.h> #include <linux/prefetch.h> +#include <linux/suspend.h> #include "e1000.h" @@ -6918,6 +6919,12 @@ static int __e1000_resume(struct pci_dev *pdev) return 0; } +static __maybe_unused int e1000e_pm_prepare(struct device *dev) +{ + return pm_runtime_suspended(dev) && + pm_suspend_via_firmware(); +} + static __maybe_unused int e1000e_pm_suspend(struct device *dev) { struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev)); @@ -7626,7 +7633,7 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) e1000_print_device_info(adapter); - dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NO_DIRECT_COMPLETE); + dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_SMART_PREPARE); if (pci_dev_run_wake(pdev) && hw->mac.type < e1000_pch_cnp) pm_runtime_put_noidle(&pdev->dev); @@ -7851,6 +7858,7 @@ MODULE_DEVICE_TABLE(pci, e1000_pci_tbl); static const struct dev_pm_ops e1000_pm_ops = { #ifdef CONFIG_PM_SLEEP + .prepare = e1000e_pm_prepare, .suspend = e1000e_pm_suspend, .resume = e1000e_pm_resume, .freeze = e1000e_pm_freeze,