Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2449988ybt; Fri, 3 Jul 2020 09:19:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqEjzVouYoiZU6EviUFiSRVB/h/J4TJY/dLigyfBu2jj8+xPktCMZGchqrlBGxpUlhvlp/ X-Received: by 2002:aa7:cb55:: with SMTP id w21mr34963175edt.380.1593793141243; Fri, 03 Jul 2020 09:19:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593793141; cv=none; d=google.com; s=arc-20160816; b=iQ7iPSix63gngeW1/f5YsnIeUMlcCHB0+ERrRhPLAvm3ZqKOo4f3XZIdGvEtc3pcfP dXbUgSEUiSJ10q3SuPsyAIuIj95uBRKxYHTVeHKiKElbc6dGYuF5Zl9NHkRAlhTk2a6E 58JVSBO8kuUbT5gZ4xxvQJ+SQJIkYosVf5ZsTGPWFGguulg2M6qx1uFit6h36xpxeYxX gumFihHLVNbXEDR3XPnG3m+sRMr2XeCS94Sq1/A9rV7d2eXFYXBRZsu/xIn+pr9XtBd7 25mjs0YInnd6CJaXmoEjDLCJIf77SgTOYcn5sKwff3yyzm0VvepOCQXjazoYyIxjrFqp 0ALw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=qiEZaKZ9FC6yDmrpUiBYeXNjpNa2H+Da4zGNKkrzBmA=; b=tBhZd++jtYR825NJf40fSZ6cU8YirvWjbj4cHf+OF2SKZ6sqxzRXVW16AJzK6UVzn9 yFKoSNg0uE/iesBbJu4km4KhnN1zhIOGVoBakYdSRmN5kOlXGoN7w1zKgPP7cJ6TDNTl sTdJNweXig2ZVt1bdnMJUzAYkaCpzsQ5NlDjHmg3idj+p1YHqSNPn3+KdscmOj0KtFf8 hL27WORxgVa9pWus00s3j3gwJC6uokHmu0QjNQoQqpA2dQE+0kx846RSfFI79oxSvzvd gdFf4wUum65LxCgeQlx7cv0RYJkj1i4dyxztdJbyzliImz5RaV9bRIaS4CNxh0xg/XgN ofow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-powerpc-org.20150623.gappssmtp.com header.s=20150623 header.b=De8MqE6o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pw19si8291090ejb.752.2020.07.03.09.18.38; Fri, 03 Jul 2020 09:19:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-powerpc-org.20150623.gappssmtp.com header.s=20150623 header.b=De8MqE6o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726616AbgGCQS1 (ORCPT + 99 others); Fri, 3 Jul 2020 12:18:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726098AbgGCQS0 (ORCPT ); Fri, 3 Jul 2020 12:18:26 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 358E2C08C5DD for ; Fri, 3 Jul 2020 09:18:26 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id p20so34789175ejd.13 for ; Fri, 03 Jul 2020 09:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-powerpc-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=qiEZaKZ9FC6yDmrpUiBYeXNjpNa2H+Da4zGNKkrzBmA=; b=De8MqE6obLkfjvoFPW9CRmvzox7ddURkpzlnlbuIHhuhT1ugHuW25ywzcQfHfRQFRf dXOm3vwqSpxXpMngdWyV5KB4W1cVUJC+A7VcC+MIV8qVStAJSY4lE4K6n1/czDejlJhF LK7H2rqhTlcl6dKw2adPgEJwvOqC/bK/52/T78IKh3IiCUDGdlkk2cAoQSKORZdwFMsH n06pPHDrAhU/v4uc+Dz35b+pIg0aCfMLnSy/1bub8Uwf/xrhhOVX3VXgCvSWxA4d7edq mZdTDGKBawOcplvf7HTh3glcWRRanARemg+Vr8567Qn105IeVxQC7IoP5U+dmSXI+ZdP BQKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=qiEZaKZ9FC6yDmrpUiBYeXNjpNa2H+Da4zGNKkrzBmA=; b=Fj8m+eDsYzCxY/HM7OM9j5HaUdm0kwiTzpVdhIYxJcL6XNf+DXS5XNsXUpDusZxZAr DaDBZ33035RMVHpdtJ2LnPTmsSLgFnjHSZ3i1ziX0WAZHNPBkHtMubG3uq7qsEyxFd51 HgI9b4z8FDOFPanvukrZ0fnAp6rBRPDuuIulAV2FbaqQx5GMN3mmN3qbPtx1mmWjZthh zb/wvVlj8hniVhUdpzSAEb1kqUoh9lVS9bCj1ChRxrwQb0Dasu/LTQ9IOvkwDWyDEXjX wryBqWHVUAVp8OxWOWmCN6R7N8xtmHskvC8QRR21ABUIpRQaKkL8tzXzx1uZqwC16qNp xwKA== X-Gm-Message-State: AOAM531274oXjWc+tl+YBi7MbVbSypXLn0suqEmFm9k71rsbRZZFjeaK G7LZ7ddX0WilO7hHmX1gGk7CgjCaheml49aUiiUxXA== X-Received: by 2002:a17:906:6897:: with SMTP id n23mr31801112ejr.473.1593793104893; Fri, 03 Jul 2020 09:18:24 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a50:3a1b:0:0:0:0:0 with HTTP; Fri, 3 Jul 2020 09:18:24 -0700 (PDT) X-Originating-IP: [5.35.13.201] In-Reply-To: <20200701165057.667799-7-vaibhavgupta40@gmail.com> References: <20200701165057.667799-1-vaibhavgupta40@gmail.com> <20200701165057.667799-7-vaibhavgupta40@gmail.com> From: Denis Kirjanov Date: Fri, 3 Jul 2020 19:18:24 +0300 Message-ID: Subject: Re: [PATCH v2 06/11] sundance: use generic power management To: Vaibhav Gupta Cc: Bjorn Helgaas , Bjorn Helgaas , bjorn@helgaas.com, Vaibhav Gupta , "David S. Miller" , Jakub Kicinski , David Dillow , Ion Badulescu , Netanel Belgazal , Arthur Kiyanovski , Guy Tzalik , Saeed Bishara , Zorik Machulsky , Derek Chickles , Satanand Burla , Felix Manlunas , Ajit Khaparde , Sriharsha Basavapatna , Somnath Kotur , Tariq Toukan , Jon Mason , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, skhan@linuxfoundation.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/1/20, Vaibhav Gupta 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 Should be fine. I'll try to test it in the upcoming weekend > --- > 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 > >