From: Bjorn Helgaas <helgaas@kernel.org>
To: Vaibhav Gupta <vaibhavgupta40@gmail.com>, rjw@rjwysocki.net
Cc: linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [Linux-kernel-mentees] [PATCH v1] ethernet: intel: e1000: Convert to dev_pm_ops
Date: Fri, 10 Apr 2020 19:23:10 -0500 [thread overview]
Message-ID: <20200411002310.GA44923@google.com> (raw)
In-Reply-To: <20200410124418.34640-1-vaibhavgupta40@gmail.com>
On Fri, Apr 10, 2020 at 06:14:19PM +0530, Vaibhav Gupta wrote:
> Convert the legacy callback .suspend() and .resume()
> to the generic ones.
> drivers/net/ethernet/intel/e1000/e1000_main.c | 47 +++++--------------
> @@ -5068,12 +5065,6 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake)
> e1000_down(adapter);
> }
>
> -#ifdef CONFIG_PM
> - retval = pci_save_state(pdev);
> - if (retval)
> - return retval;
> -#endif
__e1000_shutdown() is used in both by both e1000_suspend() and
e1000_shutdown(). Suspend is obviously for power management, but I
don't understand the connection between shutdown and PM. Why would
something in the shutdown path would depend on CONFIG_PM?
If we're in the shutdown path, we're either going to power off the
whole machine or reboot (or kexec a new kernel). In any event, I
don't think the pci_save_state() is needed, so removing it shouldn't
hurt shutdown.
But I'm curious about this common idiom in e1000 and other network
drivers:
e1000_shutdown()
{
...
if (system_state == SYSTEM_POWER_OFF) {
pci_wake_from_d3(pdev, wake);
pci_set_power_state(pdev, PCI_D3hot);
}
}
The pci_wake_from_d3() part sort of makes sense -- we want to
configure the device for wake-on-lan. But all the drivers that do
this are network drivers. USB, keyboard, etc drivers also need that
functionality, but none of them use pci_wake_from_d3(). Why?
And why do we need the pci_set_power_state()? Seems like if we're
going to power off the whole machine we wouldn't need to set devices
to D3hot. Almost all the pci_set_power_state(pdev, PCI_D3hot) calls
are from legacy suspend functions (which makes sense to me) or network
driver shutdown functions, and I don't understand why network drivers
do this differently than others.
Bjorn
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
next prev parent reply other threads:[~2020-04-11 0:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-10 12:44 [Linux-kernel-mentees] [PATCH v1] ethernet: intel: e1000: Convert to dev_pm_ops Vaibhav Gupta
2020-04-11 0:15 ` Bjorn Helgaas
2020-04-11 14:03 ` Vaibhav Gupta
2020-04-11 0:23 ` Bjorn Helgaas [this message]
2020-04-23 0:24 ` Bjorn Helgaas
2020-05-01 20:58 ` Bjorn Helgaas
2020-05-01 21:19 ` Kirsher, Jeffrey T
2020-05-01 21:45 ` Bjorn Helgaas
2020-05-18 15:07 ` Vaibhav Gupta
2020-05-18 15:27 ` Bjorn Helgaas
2020-05-18 15:30 ` Vaibhav Gupta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200411002310.GA44923@google.com \
--to=helgaas@kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=rjw@rjwysocki.net \
--cc=vaibhavgupta40@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox