Re: [PATCH v3] Gigabit Ethernet driver of Topcliff PCH

From: Rafael J. Wysocki
Date: Sun Sep 12 2010 - 18:20:42 EST


On Friday, September 10, 2010, Rafael J. Wysocki wrote:
> On Friday, September 10, 2010, Jiri Slaby wrote:
> > Ccing Rafael (please find pch_gbe_resume here)

Thanks.

...
> >
> > > +#ifdef CONFIG_PM
> > > +static int pch_gbe_resume(struct pci_dev *pdev)
> > > +{
> > > + struct net_device *netdev = pci_get_drvdata(pdev);
> > > + struct pch_gbe_adapter *adapter = netdev_priv(netdev);
> > > + struct pch_gbe_hw *hw = &adapter->hw;
> > > + u32 err;
> > > +
> > > + pci_enable_wake(pdev, PCI_D0, 0);
> > > + pci_set_power_state(pdev, PCI_D0);
> > > + pci_restore_state(pdev);
> > > + err = pci_enable_device(pdev);
> > > + if (err) {
> > > + pr_err("Cannot enable PCI device from suspend\n");
> > > + return err;
> > > + }
> > > + pci_set_master(pdev);
> >
> > Not sure which of those you need. Rafael may tell you more. You should
> > not set power state and restore state, but I might be wrong.

You're basically right. In fact you're supposed to use struct dev_pm_ops
for defining PM callbacks and then you don't need do any PCI-specific
operations directly in the driver.

All of this is described in detail in Documentation/power/pci.txt and you
can have a look into r8169.c for a reference implementation.

Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/