[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOJe8K3j=FJ2-J+CqeG-hUXApi+UgqX83U20m-2YpgD+tEvgPg@mail.gmail.com>
Date: Wed, 8 Jul 2020 13:43:15 +0300
From: Denis Kirjanov <kda@...ux-powerpc.org>
To: Vaibhav Gupta <vaibhavgupta40@...il.com>
Cc: Bjorn Helgaas <helgaas@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>, bjorn@...gaas.com,
Vaibhav Gupta <vaibhav.varodek@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
David Dillow <dave@...dillows.org>,
Ion Badulescu <ionut@...ula.org>,
Netanel Belgazal <netanel@...zon.com>,
Arthur Kiyanovski <akiyano@...zon.com>,
Guy Tzalik <gtzalik@...zon.com>,
Saeed Bishara <saeedb@...zon.com>,
Zorik Machulsky <zorik@...zon.com>,
Derek Chickles <dchickles@...vell.com>,
Satanand Burla <sburla@...vell.com>,
Felix Manlunas <fmanlunas@...vell.com>,
Ajit Khaparde <ajit.khaparde@...adcom.com>,
Sriharsha Basavapatna <sriharsha.basavapatna@...adcom.com>,
Somnath Kotur <somnath.kotur@...adcom.com>,
Tariq Toukan <tariqt@...lanox.com>,
Jon Mason <jdmason@...zu.us>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-kernel-mentees@...ts.linuxfoundation.org,
skhan@...uxfoundation.org
Subject: Re: [PATCH v2 06/11] sundance: use generic power management
On 7/3/20, Denis Kirjanov <kda@...ux-powerpc.org> wrote:
> On 7/1/20, Vaibhav Gupta <vaibhavgupta40@...il.com> wrote:
>> With legacy PM, drivers themselves were responsible for managing the
>> device's power states and takes care of register states.
>>
>> After upgrading to the generic structure, PCI core will take care of
>> required tasks and drivers should do only device-specific operations.
>>
>> Thus, there is no need to call the PCI helper functions like
>> pci_enable/disable_device(), pci_save/restore_sate() and
>> pci_set_power_state().
>>
>> Compile-tested only.
>>
>> Signed-off-by: Vaibhav Gupta <vaibhavgupta40@...il.com>
>
> Should be fine. I'll try to test it in the upcoming weekend
Unfortunately the suspend mode is broken on my test machine so I will
take some time :/
>
>> ---
>> drivers/net/ethernet/dlink/sundance.c | 27 ++++++++-------------------
>> 1 file changed, 8 insertions(+), 19 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/dlink/sundance.c
>> b/drivers/net/ethernet/dlink/sundance.c
>> index dc566fcc3ba9..ca97e321082d 100644
>> --- a/drivers/net/ethernet/dlink/sundance.c
>> +++ b/drivers/net/ethernet/dlink/sundance.c
>> @@ -1928,11 +1928,9 @@ static void sundance_remove1(struct pci_dev *pdev)
>> }
>> }
>>
>> -#ifdef CONFIG_PM
>> -
>> -static int sundance_suspend(struct pci_dev *pci_dev, pm_message_t state)
>> +static int __maybe_unused sundance_suspend(struct device *dev_d)
>> {
>> - struct net_device *dev = pci_get_drvdata(pci_dev);
>> + struct net_device *dev = dev_get_drvdata(dev_d);
>> struct netdev_private *np = netdev_priv(dev);
>> void __iomem *ioaddr = np->base;
>>
>> @@ -1942,30 +1940,24 @@ static int sundance_suspend(struct pci_dev
>> *pci_dev,
>> pm_message_t state)
>> netdev_close(dev);
>> netif_device_detach(dev);
>>
>> - pci_save_state(pci_dev);
>> if (np->wol_enabled) {
>> iowrite8(AcceptBroadcast | AcceptMyPhys, ioaddr + RxMode);
>> iowrite16(RxEnable, ioaddr + MACCtrl1);
>> }
>> - pci_enable_wake(pci_dev, pci_choose_state(pci_dev, state),
>> - np->wol_enabled);
>> - pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state));
>> +
>> + device_set_wakeup_enable(dev_d, np->wol_enabled);
>>
>> return 0;
>> }
>>
>> -static int sundance_resume(struct pci_dev *pci_dev)
>> +static int __maybe_unused sundance_resume(struct device *dev_d)
>> {
>> - struct net_device *dev = pci_get_drvdata(pci_dev);
>> + struct net_device *dev = dev_get_drvdata(dev_d);
>> int err = 0;
>>
>> if (!netif_running(dev))
>> return 0;
>>
>> - pci_set_power_state(pci_dev, PCI_D0);
>> - pci_restore_state(pci_dev);
>> - pci_enable_wake(pci_dev, PCI_D0, 0);
>> -
>> err = netdev_open(dev);
>> if (err) {
>> printk(KERN_ERR "%s: Can't resume interface!\n",
>> @@ -1979,17 +1971,14 @@ static int sundance_resume(struct pci_dev
>> *pci_dev)
>> return err;
>> }
>>
>> -#endif /* CONFIG_PM */
>> +static SIMPLE_DEV_PM_OPS(sundance_pm_ops, sundance_suspend,
>> sundance_resume);
>>
>> static struct pci_driver sundance_driver = {
>> .name = DRV_NAME,
>> .id_table = sundance_pci_tbl,
>> .probe = sundance_probe1,
>> .remove = sundance_remove1,
>> -#ifdef CONFIG_PM
>> - .suspend = sundance_suspend,
>> - .resume = sundance_resume,
>> -#endif /* CONFIG_PM */
>> + .driver.pm = &sundance_pm_ops,
>> };
>>
>> static int __init sundance_init(void)
>> --
>> 2.27.0
>>
>>
>
Powered by blists - more mailing lists