Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp604111ybt; Wed, 1 Jul 2020 06:05:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/gDJY5b/LdH61cTrVX6uUwoQdvmhleBBXD+m7RmcRjRL3AX7kvmm6Be/UJ2zKWzimV48E X-Received: by 2002:a17:906:48d3:: with SMTP id d19mr22164641ejt.180.1593608756407; Wed, 01 Jul 2020 06:05:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593608756; cv=none; d=google.com; s=arc-20160816; b=aBioqRUbq3uK27/KAfy4LIHaoWAuxfm7RBYDEHMsVo1jfNXRZCf0LfigUGM1167uke raLa5iGVokBtAVXyjOlBUYZx2GJSiwyvQVhto9RKXa2+Qzsh7YAIG4VihFnKWrxy70Q8 K9LKf/n2+oGN3+s6Q9ZjyPeNYa5qLQU4/pP3WpVb7hsqYBa+0AxJWffomovg+pMJAN41 K0eH+vAjeol1jythuY9xXjptyIH7cuxKOM7nPneIwIOyY8IKQTp0IjEC0ef4LXtg3jgD /lfHCUhgqrfcpBckINuKEbv+zsKZv1TGs+DGNhUXgxELMwbN8SuXTMBdglxYgcvdzXKe E6Jw== 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=JaFJ/hx4zZUnfgo4JKE7j2RfbZZGmBOayqe3X94Vna0=; b=0GmRY/c79Lp9I6tEli3YE2iWPS02Thb7EV3wLMI9gRNnuedgSrHy0uaP5gN/AOBDGi pe78AG7OYt6aQPxG2LoCT8zmVyECafOY0AH+6k8PibWF3/vnbT/NYdRcitNByfNSCinZ Ul4iDjoOQKJPcORjoaKTG5cL2e3gKQsK+9mfauyy38qPcvDTmyqXGzElpiXmzmOwGW9R AUGEOeBxoqrVhcQG4qrjl6TpPKpoYTr/rhzxqzBBNEaS4cgfkF642iy+xNl3VUohIqP5 7RXIxDIhhPHcHMqSZRGR5VG63KlkWcCQ5EH+Sm7xXqmFee3c3J+D5QkQkG9jidP7r02l Yvbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SeI6jd5q; 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 du7si4963254ejc.341.2020.07.01.06.05.31; Wed, 01 Jul 2020 06:05:56 -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=SeI6jd5q; 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 S1730961AbgGANDM (ORCPT + 99 others); Wed, 1 Jul 2020 09:03:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730723AbgGANC7 (ORCPT ); Wed, 1 Jul 2020 09:02:59 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05257C03E979; Wed, 1 Jul 2020 06:02:59 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id b92so11023296pjc.4; Wed, 01 Jul 2020 06:02:59 -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=JaFJ/hx4zZUnfgo4JKE7j2RfbZZGmBOayqe3X94Vna0=; b=SeI6jd5qcI4MWoIJWk7OAlSq5pCtb1e//GYnPJkLZHhiMeIN8KTJBOdpjRIOH/FYMA 8DAayXy3U7R6bWIteOxdM7iLgUKdf/TCVQQzoklLKuKPeXxMSClWpzUH+qzzbr+IPHHE HWI/xcb4ZgfbwdnsUyHIsaGri+JAL6KCDcIgGBjUhb5sZGXijZIaCXm9nSMeW4GqKDi3 or9HMHb0eTQkijuu/JIgEESfmZemF5mRy35T6pn0U5X73aMCbE0thuRw90Q29a5LRap+ BPyBfgZAakSYWrGBKfJYFJNexoQ6UXRcSeUXDql8oiTHCnq+FBfe9zg4OwQWEDoMMS2z TOqQ== 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=JaFJ/hx4zZUnfgo4JKE7j2RfbZZGmBOayqe3X94Vna0=; b=Q6Wq/FwMNw1Hy+sZoyZCCUi5pPhfeTk+4T2ybwMefcSUd2Qs1hQ5a/Yjs5/8oOsKpL BTPOMjNffJGaYDM8hC0tZDODViYhs05jfgbga9/vVqz79dHKYUnD5OFQNmaHqHrMc/DS /RqFucKJcgrws+2wnCZLljP+ZGFuNuV8FZ+w+5ROYFzs0dHpU3PPgbWA4dhuzhAK0Cpw RVrGML4bWk3iZpUi5tiBbEEIwF8/M+F7DTGPDrZnlVu//GC0zx2jUxORZ7y/tTIztTEi 1oU15Kd4wmNFsfX8oFUiZNfQOtK3MM7/zyJr5c8UHK4tRDJZWWnAmsC1daiVb0nV2vET 1Baw== X-Gm-Message-State: AOAM531ibr9ydKog/GL6RrDRnOLy7erCAY5PMj7yx0XprKjH0PZa+zo+ BbSGAfJ4IZDLXAXH+hh1k1A= X-Received: by 2002:a17:902:eed4:: with SMTP id h20mr802787plb.100.1593608578403; Wed, 01 Jul 2020 06:02:58 -0700 (PDT) Received: from varodek.iballbatonwifi.com ([103.105.153.57]) by smtp.gmail.com with ESMTPSA id d9sm6070908pgv.45.2020.07.01.06.02.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2020 06:02:57 -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 07/11] benet: use generic power management Date: Wed, 1 Jul 2020 18:29:34 +0530 Message-Id: <20200701125938.639447-8-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/emulex/benet/be_main.c | 22 +++++++-------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index a7ac23a6862b..e26f59336cfd 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -6037,32 +6037,23 @@ static int be_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id) return status; } -static int be_suspend(struct pci_dev *pdev, pm_message_t state) +static int __maybe_unused be_suspend(struct device *dev_d) { - struct be_adapter *adapter = pci_get_drvdata(pdev); + struct be_adapter *adapter = dev_get_drvdata(dev_d); be_intr_set(adapter, false); be_cancel_err_detection(adapter); be_cleanup(adapter); - pci_save_state(pdev); - pci_disable_device(pdev); - pci_set_power_state(pdev, pci_choose_state(pdev, state)); return 0; } -static int be_pci_resume(struct pci_dev *pdev) +static int __maybe_unused be_pci_resume(struct device *dev_d) { - struct be_adapter *adapter = pci_get_drvdata(pdev); + struct be_adapter *adapter = dev_get_drvdata(dev_d); int status = 0; - status = pci_enable_device(pdev); - if (status) - return status; - - pci_restore_state(pdev); - status = be_resume(adapter); if (status) return status; @@ -6234,13 +6225,14 @@ static const struct pci_error_handlers be_eeh_handlers = { .resume = be_eeh_resume, }; +static SIMPLE_DEV_PM_OPS(be_pci_pm_ops, be_suspend, be_pci_resume); + static struct pci_driver be_driver = { .name = DRV_NAME, .id_table = be_dev_ids, .probe = be_probe, .remove = be_remove, - .suspend = be_suspend, - .resume = be_pci_resume, + .driver.pm = &be_pci_pm_ops, .shutdown = be_shutdown, .sriov_configure = be_pci_sriov_configure, .err_handler = &be_eeh_handlers -- 2.27.0