Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp604947ybt; Wed, 1 Jul 2020 06:06:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4i3/14YqUafRg8cDhwp8Zk+BlMuuSWLXFQ8+KmlVKBS/RNO99bttQ3cefb7UuLgmRHBXx X-Received: by 2002:a17:906:c1d8:: with SMTP id bw24mr13408956ejb.91.1593608806658; Wed, 01 Jul 2020 06:06:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593608806; cv=none; d=google.com; s=arc-20160816; b=o3T/osiNh2/i+Ry9X8QkMvEuIYVHvP5MrmMvD0l8GgkZ23bhkZ2RULuDbmChT9V23k 74Na9/4qegdY2nIP6pWkV8ZJRO4A7lxrC15nx535EsRCfF377UJFqASk8bzt7VDnGI3K Kytv/QQhT6Q/o7EcoHPKPwYH7Ylq+2WJGJlXRC08UKU/uAXIW4k9TPttj/8Q5OA6PVPa gVSu9gMmxoh/3tFGLtvEjypzvhrkbSMMKifeZG8EK6IRnZod8XEgt4fB6iXL7q+RLI6r 7qCnwWqAtU1mJHqj2zgjwATeioEySoHQV0yaE6VVkY7spI+VDKEmh6gVA4YZgVyn/in3 Tp4Q== 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=EKYZXzZpvGyQZUTSB7ZSTs6hRzQBV8VsnesAValvrlI=; b=VK2xXkybBDTVU7tOnsqpnmEbRnEZUauHxaLkgNCBvmnLjW9GWXvoeqEzzy6yCrdBQy YfexEQ6M5cc/JMMaNF0eSay+cuvi1GR6oj7uh03KxG1PJmu2DuoP+wMqUSxBeFZ07kMM A1uNesrkROQxVxRtewnYsCmEJeohnDzcFmBz/fweLKtZyF8/mgoZ8tkfGvwt5wIJcYBQ BL8AmNVbjQJzFl90yxRd93JwsXA5xDCmmTD7ZTP/pDMumagIc/CINXES3ODPjwO5QhQy QgXkR1NaSNSYoABSBVyn7GzLFFIOos6ExGOInhfaz8/9KTVUlvVgyK7dZhEjuVek+Qpl cdtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aImzrxZ2; 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 do18si4690737ejc.668.2020.07.01.06.06.23; Wed, 01 Jul 2020 06:06:46 -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=aImzrxZ2; 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 S1731010AbgGANDf (ORCPT + 99 others); Wed, 1 Jul 2020 09:03:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730581AbgGANDd (ORCPT ); Wed, 1 Jul 2020 09:03:33 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E83B6C03E979; Wed, 1 Jul 2020 06:03:32 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id x8so8998570plm.10; Wed, 01 Jul 2020 06:03:32 -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=EKYZXzZpvGyQZUTSB7ZSTs6hRzQBV8VsnesAValvrlI=; b=aImzrxZ2dEPDUptNv4rU/IQVZHmlhEPUJIKTPHtZH3/MdAGynfnz/+90DDeSz13ob/ CLqnmT/+VzDk/cJ5K3RbAbKn7yeSOHOwoQxQheq29te4WCsH00pokenYxBXBLbTmhLwb zCUH8aqdWJ5AR4LV7gIZgoKuvA4VBhwwF1B4BEm0DqzLr61RO/8/vkoh9KlQqCNkRp9n Pj7++rTAc1b0ID0xaEf56Pv1mIsNjtfN7bdEulXBgIjlKHgO56l1bNI72wKSRHMs8Vrx X6d0rQ0P76HGyR7HqLL1yjaGYsTEIQSz7E+AzOGpxwd6yOLeYrPbqWeeYy6rsLq4D9nz LjoQ== 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=EKYZXzZpvGyQZUTSB7ZSTs6hRzQBV8VsnesAValvrlI=; b=gmEyJD+8ykdq1xvvBSqv08GdDfKAf+h3XvYOp6MrmCHo5Ndkt7XN0mM82oVEw9Coi3 9/hxgC/G4u2kIlGBx+r2ezA5T58QRR1h9dzxrDp8hMch6/A2kjLWaWvwroU2bZHJI8hA 4uyw1tD7MeU3VIjtRJjhd2Uvyr7PGg4QI1QQVvSmUMevqvtFWss4yHLE28W5hPpsMaYl eMDOq2dIH/99uVLQadG9CRoeVrkVRpQtrtwx87aIW+tf+kSdgZYpIvu5DPzR2xcq3wep GFPWqyj+9/72qMrHPGlZXKJSq2DK5XXYSBiEpw4/B7HEB7a5r8VI7SVbG6CAdlEUzaPU WMfw== X-Gm-Message-State: AOAM531DCQDbc1JMeTDZ0imBUcFDPt0Yb1M/YndbKzafk17Jz69T4unR IsbCEJa2wE2RYhNX4CvT0zI= X-Received: by 2002:a17:902:a515:: with SMTP id s21mr14416862plq.192.1593608612248; Wed, 01 Jul 2020 06:03:32 -0700 (PDT) Received: from varodek.iballbatonwifi.com ([103.105.153.57]) by smtp.gmail.com with ESMTPSA id d9sm6070908pgv.45.2020.07.01.06.03.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2020 06:03:31 -0700 (PDT) From: Vaibhav Gupta To: 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 , Denis Kirjanov , Ajit Khaparde , Sriharsha Basavapatna , Somnath Kotur , Tariq Toukan , Jon Mason Cc: Vaibhav Gupta , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, skhan@linuxfoundation.org Subject: [PATCH v1 11/11] natsemi: use generic power management Date: Wed, 1 Jul 2020 18:29:38 +0530 Message-Id: <20200701125938.639447-12-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200701125938.639447-1-vaibhavgupta40@gmail.com> References: <20200701125938.639447-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 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_device, which is not recommended. Hence, removed. Compile-tested only. Signed-off-by: Vaibhav Gupta --- drivers/net/ethernet/natsemi/natsemi.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/natsemi/natsemi.c b/drivers/net/ethernet/natsemi/natsemi.c index d21d706b83a7..c2867fe995bc 100644 --- a/drivers/net/ethernet/natsemi/natsemi.c +++ b/drivers/net/ethernet/natsemi/natsemi.c @@ -3247,8 +3247,6 @@ static void natsemi_remove1(struct pci_dev *pdev) free_netdev (dev); } -#ifdef CONFIG_PM - /* * The ns83815 chip doesn't have explicit RxStop bits. * Kicking the Rx or Tx process for a new packet reenables the Rx process @@ -3275,9 +3273,9 @@ static void natsemi_remove1(struct pci_dev *pdev) * Interrupts must be disabled, otherwise hands_off can cause irq storms. */ -static int natsemi_suspend (struct pci_dev *pdev, pm_message_t state) +static int __maybe_unused natsemi_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 = ns_ioaddr(dev); @@ -3326,11 +3324,10 @@ static int natsemi_suspend (struct pci_dev *pdev, pm_message_t state) } -static int natsemi_resume (struct pci_dev *pdev) +static int __maybe_unused natsemi_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 ret = 0; rtnl_lock(); if (netif_device_present(dev)) @@ -3339,12 +3336,6 @@ static int natsemi_resume (struct pci_dev *pdev) const int irq = np->pci_dev->irq; BUG_ON(!np->hands_off); - ret = pci_enable_device(pdev); - if (ret < 0) { - dev_err(&pdev->dev, - "pci_enable_device() failed: %d\n", ret); - goto out; - } /* pci_power_on(pdev); */ napi_enable(&np->napi); @@ -3364,20 +3355,17 @@ static int natsemi_resume (struct pci_dev *pdev) netif_device_attach(dev); out: rtnl_unlock(); - return ret; + return 0; } -#endif /* CONFIG_PM */ +static SIMPLE_DEV_PM_OPS(natsemi_pm_ops, natsemi_suspend, natsemi_resume); static struct pci_driver natsemi_driver = { .name = DRV_NAME, .id_table = natsemi_pci_tbl, .probe = natsemi_probe1, .remove = natsemi_remove1, -#ifdef CONFIG_PM - .suspend = natsemi_suspend, - .resume = natsemi_resume, -#endif + .driver.pm = &natsemi_pm_ops, }; static int __init natsemi_init_mod (void) -- 2.27.0