Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp601616ybt; Wed, 1 Jul 2020 06:03:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfFIvNRtqDIvh5VqszMdwDeQ2wD8dZzL7/Sc1OqmMt5u5CnavDW2dziB8guCoqOS/BP+yi X-Received: by 2002:a05:6402:17ee:: with SMTP id t14mr26034073edy.359.1593608615669; Wed, 01 Jul 2020 06:03:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593608615; cv=none; d=google.com; s=arc-20160816; b=ejHlavP1yD/4eICOpgO5PMTJFhRcUJSBYYj8zvm26VzM7rqd1goIe71c4cAOP5IDzH k1jpEX0JPR75G3ZzdslutULSnxK4eS0aG7GLG3etlMh0rdVzc5IuFYFG1Qw4rP4D+gjv hwEX6Tv0qJ7JhtiqWfNzz5LRRTWt6fNeaNwy5+46FMrLCcQdFmGV8tcyeqwYac7DFukN 03bSn+9tjYWnShr4j0JPFXRpEnhJfqib+OKCxgq5nF7Y+/z8/OQebEyRS0m2pQtLfWgZ Ozd+7/jKnCPGTmADh9FRQVWPeNigiNHcklRSSky4T2Quss7QiEuNQRbpgP3C3LxLOLJG 7/Uw== 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=9tRb3lcQnQNyqSPd2RUudBp4K9fTszNeoadKdLTyh8Y=; b=XOLgVh5SZ3mD3qRdXm5VE9RamdIWfIRn3b4VJvAGgKKYxni9mI5S55L7/He6k1uWp4 UZDVD7ZfHh18bUYmNBYDA33PpWqhNssjbuocgnHvsQYUJudfDFQjM8lWBo5sBsTZw+g0 Kvy2cI5qVzyh8bhfek1UC9+xnPo2PgXAfxx8urg/qzLocSmkC7eEVefC9srSSOQ7xmgQ WvmLVA0ttniaNHGJVbrKH3k6mNZy0EVIDX2hXKotBS1PSbFmfAQp3yHG+oJsiLHZLEEa SOKJD1raMCJ7sKB7aHl1K19wgR9ECmRwgQ7pDNsZqlhQBDvk07A+H+CXYGSWx6DpL0Js Dmgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=np+tZ2jm; 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 t16si3793146edc.161.2020.07.01.06.03.10; Wed, 01 Jul 2020 06:03:35 -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=np+tZ2jm; 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 S1730856AbgGANCS (ORCPT + 99 others); Wed, 1 Jul 2020 09:02:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730812AbgGANCQ (ORCPT ); Wed, 1 Jul 2020 09:02:16 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3372C03E979; Wed, 1 Jul 2020 06:02:15 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id j12so10972350pfn.10; Wed, 01 Jul 2020 06:02:15 -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=9tRb3lcQnQNyqSPd2RUudBp4K9fTszNeoadKdLTyh8Y=; b=np+tZ2jmuroP/ACE0gq1rtk344QwU0PDDtd4OKhwpzFSam+YeQkJVTobzT4asxV+N7 5vaGxInqgUw8SDFu5i1qyGtpI2AsSF7tU1r5HUplZJXXqNNCQFxiVx6c1K62JoesC+lb IESzdLyjcNrtj6s1tx9XuoJ7VGlCVp1uMJetLO/uuNy1A+f15CJ9kX2aJ1jkv8wVJqiJ 19vIDyRXhqxIYm0Tsw1DONPxTKciIHCVznpsu43eNBexgFCX9IgSkNBTa7XGxpDEu0of oqmgR/KVPPF2UwVV/jC3pZpvR+W0ZVP6t78UzeE2mts3jbb2aF+Gpi28hCDewFe7mxPS dTdQ== 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=9tRb3lcQnQNyqSPd2RUudBp4K9fTszNeoadKdLTyh8Y=; b=EYxJynkrXq7RTubYLiFBKI29Xm9v7s+6qLJD+kQlIJz006DGTyxTmdywMotrr7BL4b aH6WcsYQ6YlIs3d1qLy2GgDtcqRkLI5MDDrJqotm2Taq953TD7bsMSzG0viLZ0toAPEI C3wZVD3RUBIznxZ4Fzgrth8JgjdWTJF3FmiXuZSwwfJ/PvcULqgCTsZtOX5kBRt5s3O1 siWe7mhY643T+C2EESjJw/07ct/P6SHvHy6n6PpuEf2kDxnPGcZUBmT0Ycnx8Xzw3sSr 1QiVGyniCdydZhKwZUdeZwscfuXyAUx7JMVffwnrMF47iNezL3jKvFmDXxe5/NnvUKUm Z0uw== X-Gm-Message-State: AOAM530NuAtwhw+5mp3QzbXoaqDTrLYVfqQA2W+BZORwjHQ3oxNbcPk4 M10GaKbWx0vkfZGUjvrK0NM= X-Received: by 2002:a63:441c:: with SMTP id r28mr18102161pga.372.1593608534913; Wed, 01 Jul 2020 06:02:14 -0700 (PDT) Received: from varodek.iballbatonwifi.com ([103.105.153.57]) by smtp.gmail.com with ESMTPSA id d9sm6070908pgv.45.2020.07.01.06.01.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2020 06:02:14 -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 02/11] ne2k-pci: use generic power management Date: Wed, 1 Jul 2020 18:29:29 +0530 Message-Id: <20200701125938.639447-3-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/disable_device(), pci_save/restore_sate() and pci_set_power_state(). Compile-tested only. Signed-off-by: Vaibhav Gupta --- drivers/net/ethernet/8390/ne2k-pci.c | 29 ++++++---------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/drivers/net/ethernet/8390/ne2k-pci.c b/drivers/net/ethernet/8390/ne2k-pci.c index 77d78b4c59c4..e500f0c05725 100644 --- a/drivers/net/ethernet/8390/ne2k-pci.c +++ b/drivers/net/ethernet/8390/ne2k-pci.c @@ -699,30 +699,18 @@ static void ne2k_pci_remove_one(struct pci_dev *pdev) pci_disable_device(pdev); } -#ifdef CONFIG_PM -static int ne2k_pci_suspend(struct pci_dev *pdev, pm_message_t state) +static int __maybe_unused ne2k_pci_suspend(struct device *dev_d) { - struct net_device *dev = pci_get_drvdata(pdev); + struct net_device *dev = dev_get_drvdata(dev_d); netif_device_detach(dev); - pci_save_state(pdev); - pci_disable_device(pdev); - pci_set_power_state(pdev, pci_choose_state(pdev, state)); return 0; } -static int ne2k_pci_resume(struct pci_dev *pdev) +static int __maybe_unused ne2k_pci_resume(struct device *dev_d) { - struct net_device *dev = pci_get_drvdata(pdev); - int rc; - - pci_set_power_state(pdev, PCI_D0); - pci_restore_state(pdev); - - rc = pci_enable_device(pdev); - if (rc) - return rc; + struct net_device *dev = dev_get_drvdata(dev_d); NS8390_init(dev, 1); netif_device_attach(dev); @@ -730,19 +718,14 @@ static int ne2k_pci_resume(struct pci_dev *pdev) return 0; } -#endif /* CONFIG_PM */ - +static SIMPLE_DEV_PM_OPS(ne2k_pci_pm_ops, ne2k_pci_suspend, ne2k_pci_resume); static struct pci_driver ne2k_driver = { .name = DRV_NAME, .probe = ne2k_pci_init_one, .remove = ne2k_pci_remove_one, .id_table = ne2k_pci_tbl, -#ifdef CONFIG_PM - .suspend = ne2k_pci_suspend, - .resume = ne2k_pci_resume, -#endif - + .driver.pm = &ne2k_pci_pm_ops, }; -- 2.27.0