Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2688305ybt; Mon, 22 Jun 2020 04:46:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxc6nrGX/gYKz/c+Gj/ZwLSVIhWmRAtrJ3r/kV4mDBSWE9XTbKUMDi6iStb4YFSyznoRYIA X-Received: by 2002:a05:6402:228a:: with SMTP id cw10mr15845491edb.147.1592826400621; Mon, 22 Jun 2020 04:46:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592826400; cv=none; d=google.com; s=arc-20160816; b=s25Cxbe66oG9nkF0AkLeZsOUOCdUmWRJOUwkZgP+CoRRNXfq0OhK5E0QinCETkCmpm twTsVS8RsaBpAhgZWzusFP30MwLHVD3b0KbdL2IRG8tsmi8E0Es6sjqA2knBRDtSDchC 4La2+CAJQBN+yRdNef2ASKJ6COTfJJmnGjoXR+6NyTADxcKmHpuwCEkGqiCJ1xW4z3+r GliicHAKpytHGRu3ct2quPweXCNJZZqzgcgr4EvwK2pT23LVBrEWa5vQ2rQTVWhpywVD xMLdj8sZl6edS+qsmkUs7mx8KIl4F2vwx5cfb6kWXgf7E41IwUbgKdLglLk0Vn5CbnMB kidg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kGnJOhO4SDYQP4rIHcqc+jo7CYqIdXY8MtdWzsoIdCI=; b=fTwtnS0vhD/D11G8BZ2Rn3sLn1p9PVoP3zoV4nO5cDMuXxcdEQAHxQKbnYsfNVbnt/ iMx1+pQ3ZCfxBhdydRnrmqYds1i4vJ0DWBMDNvRxkSEMcf7q1bf9eoTEz2T23DJdVswK ACERFkfCcU0ok4y+qCE0ZmvrukGX30Q2u9UtVCjM2PFHavpXXRLcm1C00iwPLT9Hv9IZ pS8/KrnViWGdLNLcrRAxjgxWS6QabipYr98Mj74+ODvtNGRXZn/eBnjE1RA1mw+4z1FE i0C85N/1t1O113SpoEdMoU8ghIlbbg0+z1l0WtF5Ot1yS+ktCmiXzLhYq/M7A4bBi/Pe jMQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bOs13kjt; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l1si8393221ejb.642.2020.06.22.04.46.18; Mon, 22 Jun 2020 04:46:40 -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=@gmail.com header.s=20161025 header.b=bOs13kjt; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728024AbgFVLoV (ORCPT + 99 others); Mon, 22 Jun 2020 07:44:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727806AbgFVLoQ (ORCPT ); Mon, 22 Jun 2020 07:44:16 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5503CC061794; Mon, 22 Jun 2020 04:44:16 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id b201so8317622pfb.0; Mon, 22 Jun 2020 04:44:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kGnJOhO4SDYQP4rIHcqc+jo7CYqIdXY8MtdWzsoIdCI=; b=bOs13kjt6xy7YNxCUBgjD5k9fmCgmyX2SS4xWIWAQlvC5MvA5oTmblZRMWNsBNC/ul ULrMAs8Vr76/7RP5upSYHmUzXj43Hg9b8WYrc3mlv9KyffbrFyATHbKkdKhBs86C6k9c HOfZh6I0l4ZUq2UBL8FloPUkvCiUNj8aOisbAg4f00lTUypZ8v7eqBA1W4dewDB3NdyG Pt7ifMfDSuDm+x/fnMMmDJdVyioMsanuXPh75c659IQaA6uOb7bsepo4d/JuWTj53uNt EyotPx4DMmJlmPySOyisyJ0kBk/Tw/+MJGGPDvuFO42rirhiRHdW0QUQUTpR61bCnqFt FedQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kGnJOhO4SDYQP4rIHcqc+jo7CYqIdXY8MtdWzsoIdCI=; b=osUjybSUVb/6vHGjLap+DL9OHP+3HjPHBYjaloJsWCDF1qo1SHDSg4vr+hW6tSQh+B n83t24jcFa22vvseojY4fdpzssZozXgV8461TmzAK38M7UatmGJvIM+g1CN2Rqq6zJYq 8ohygH5OOcxMZlliKekpcxtY9kEBB+iWOwIcLajesQYVEEZuwCENo7wH9vjN8csJpojk jE/PL0uDhayoaLx8LlbSEdoAWd7xL2JZLmnq2cUh4rT0a17CctjxX0bmRaxvuFsnJrt/ Ow6r5rj1pPjht74m90z3L3ye6ZBJ71+VDQNOFSu3KJKh1yPBv0tK6PDMBg0MjHtMlyxS 7VEw== X-Gm-Message-State: AOAM530UazyqmYthBJVSLLGDUznlZSotAkNiq6YmIexde18J8BvYdzZK Sb1LMnp6rkNYTopQ8ag5QOM= X-Received: by 2002:a62:5c03:: with SMTP id q3mr20118520pfb.58.1592826255851; Mon, 22 Jun 2020 04:44:15 -0700 (PDT) Received: from varodek.localdomain ([2401:4900:b8b:123e:d7ae:5602:b3d:9c0]) by smtp.gmail.com with ESMTPSA id j17sm14081032pjy.22.2020.06.22.04.44.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 04:44:15 -0700 (PDT) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , bjorn@helgaas.com, "David S. Miller" , Jakub Kicinski , Vaibhav Gupta Cc: Vaibhav Gupta , linux-kernel-mentees@lists.linuxfoundation.org, skhan@linuxfoundation.org, netdev@vger.kernel.org, linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 2/5] tulip: windbond-840: use generic power management Date: Mon, 22 Jun 2020 17:12:25 +0530 Message-Id: <20200622114228.60027-3-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200622114228.60027-1-vaibhavgupta40@gmail.com> References: <20200622114228.60027-1-vaibhavgupta40@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With stable support of generic PM callbacks, drivers no longer need to use legacy .suspend() and .resume() in which they had to maintain PCI states changes and device's power state themselves. Earlier, .resume() was invoking pci_enable_device(). Drivers should not call PCI legacy helper functions, hence, it was removed. This should not change the behavior of the device as this function is called by PCI core if somehow pm_ops is not able to bind with the driver, else, required tasks are managed by the core itself. Compile-tested only. Signed-off-by: Vaibhav Gupta --- drivers/net/ethernet/dec/tulip/winbond-840.c | 26 ++++++-------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/dec/tulip/winbond-840.c b/drivers/net/ethernet/dec/tulip/winbond-840.c index 4d5e4fa53023..5dcc66f60144 100644 --- a/drivers/net/ethernet/dec/tulip/winbond-840.c +++ b/drivers/net/ethernet/dec/tulip/winbond-840.c @@ -1530,8 +1530,6 @@ static void w840_remove1(struct pci_dev *pdev) } } -#ifdef CONFIG_PM - /* * suspend/resume synchronization: * - open, close, do_ioctl: @@ -1555,9 +1553,9 @@ static void w840_remove1(struct pci_dev *pdev) * Detach must occur under spin_unlock_irq(), interrupts from a detached * device would cause an irq storm. */ -static int w840_suspend (struct pci_dev *pdev, pm_message_t state) +static int __maybe_unused w840_suspend(struct device *dev_d) { - struct net_device *dev = pci_get_drvdata (pdev); + struct net_device *dev = dev_get_drvdata(dev_d); struct netdev_private *np = netdev_priv(dev); void __iomem *ioaddr = np->base_addr; @@ -1590,21 +1588,15 @@ static int w840_suspend (struct pci_dev *pdev, pm_message_t state) return 0; } -static int w840_resume (struct pci_dev *pdev) +static int __maybe_unused w840_resume(struct device *dev_d) { - struct net_device *dev = pci_get_drvdata (pdev); + struct net_device *dev = dev_get_drvdata(dev_d); struct netdev_private *np = netdev_priv(dev); - int retval = 0; rtnl_lock(); if (netif_device_present(dev)) goto out; /* device not suspended */ if (netif_running(dev)) { - if ((retval = pci_enable_device(pdev))) { - dev_err(&dev->dev, - "pci_enable_device failed in resume\n"); - goto out; - } spin_lock_irq(&np->lock); iowrite32(1, np->base_addr+PCIBusCfg); ioread32(np->base_addr+PCIBusCfg); @@ -1622,19 +1614,17 @@ static int w840_resume (struct pci_dev *pdev) } out: rtnl_unlock(); - return retval; + return 0; } -#endif + +static SIMPLE_DEV_PM_OPS(w840_pm_ops, w840_suspend, w840_resume); static struct pci_driver w840_driver = { .name = DRV_NAME, .id_table = w840_pci_tbl, .probe = w840_probe1, .remove = w840_remove1, -#ifdef CONFIG_PM - .suspend = w840_suspend, - .resume = w840_resume, -#endif + .driver.pm = &w840_pm_ops, }; static int __init w840_init(void) -- 2.27.0