Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp784362ybt; Wed, 1 Jul 2020 09:54:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4G9jWqTJrO4h8FUzghL7OK1dSYXmxFU7aRdzYqET9jfKz3AvwMt3Aqi8QvTOySD/VfalZ X-Received: by 2002:a17:906:494a:: with SMTP id f10mr24945735ejt.428.1593622462893; Wed, 01 Jul 2020 09:54:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593622462; cv=none; d=google.com; s=arc-20160816; b=b2oGZ66rrlSxhRfmsgkTO2b6p+dWNRqj7KwDeOw8EVbYmBgfZrs0yxoNG9P6Fn65tz tiCTfhroHE26MGhqlkXWKw7ZnTwJl6xqlvFsF3kboEIZABxaffipzjDVc02gPvgdrn/R iMqKSD7BYuc8lrw0IvZIZcpUsX7tkS06mFGEZbYnRRzkBf+a8De0CI1b9lg0/HVgpWEE Noj6t/qbWt7iyn1NmWqYvgqEE+NTkg1H07q5Rsc3BqEY9vwre+nTTdwMGS0iI5cDbJZx h5+lFhe4JAAhimsWBJmt7BVaWvFpgbtvYaB6zqej1fyS2BDO/VKyS1/Q0vAuOR3U4Gpb C2Fw== 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=ZlRjk8zT4O+JvT0opsFaP8uu4DQA96Rwf9GDzwtwPpA=; b=tAB1PweuFfHQxQmpIRGZP+rKO/6DdCd0NE0RuW5G1OWb4s7u0HNrFoLWxOtUCyktG/ raS4zLkFaeN0C4a6EPDMbmt9m2jXaSGQevr6h+X57wthC5gaAe87cbZeNZE7nbInJW00 NQtxguXmvAwaz4rx8y3ix4fv5sIqjKk+AqqAWYrlkGOqO7O9LC1Bo+qSzOK3L0zwOu7Q jHuyusOaY6G39mudaPAXCb6g5szl0/ou/kx3GLtuz8SqEkGAxrgrpQXtOWk8TY5RUyUc +4OVMe5RIEuk1MqMvfJQWLnePHSxCW+kt+aR22ShB2d3UDHkINCjprqAfS8J558qmnhr QASw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FY2NiWzU; 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 mh4si4141224ejb.339.2020.07.01.09.53.59; Wed, 01 Jul 2020 09:54:22 -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=FY2NiWzU; 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 S1732679AbgGAQxN (ORCPT + 99 others); Wed, 1 Jul 2020 12:53:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732525AbgGAQxM (ORCPT ); Wed, 1 Jul 2020 12:53:12 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90BF4C08C5C1; Wed, 1 Jul 2020 09:53:12 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id gc9so4714095pjb.2; Wed, 01 Jul 2020 09:53:12 -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=ZlRjk8zT4O+JvT0opsFaP8uu4DQA96Rwf9GDzwtwPpA=; b=FY2NiWzUFm+Rb4aPl2Gz674HRT+TcH5y7/CYNs8u8pEpwsWrBrKub2G3w8UjhsInvY dU0tB6+WlgyZTc008DgVvquqb+bLe1D+toYroG9z0/d12eLy2zROHNIiiejgy+88Omdw xVLs8jdz7yI3ViWkRp2ceZqFh3ddm3qd2GDdod/6Cf3XtGQMLZbopoCV5HV7OWJUz3PE Aj0LWSUuzvJc8+adwLAc2ErIGQ7VtG6A+52D0SPkXDvaqiKirum4vmMU6bgSKifK0U/c k7v2J9UstMFBKK8y3i+soKVgjw3oqfO/yE2AHzSxXqdp7+adGiDGDnKGD9cvU/XMY0Mx uaJw== 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=ZlRjk8zT4O+JvT0opsFaP8uu4DQA96Rwf9GDzwtwPpA=; b=Z6Z7aNznelvdepWcNoBd88j/ehRWJ6Oe0etlBXX567SBR6N2hfXH2H68sfsMEF53Vy QqRzwdsxy9ATCgWCFCPvczBaCs3cHKI9qlFuA1aTQQKktdldK6EQUmeqsLaMmBNNI8RA pL8XzfXoGLaYg+4Sr5WF1K3dX23dgXGZvXaQv8WhVVSO5TOAWZVi26VRHmev9be4CY10 YQCXPmrXhqADQGpM1+zSCXNFSa5u4Fs+rTQDkqPnZyZkJ2S15tMNJw3ycXhcNvJDLVFn IlTgzzuir5zzGDt1+1TvlVP67K0ZG+707Tn0xuW2ZyS3866tRT9D63fsOna+jAacbmtf Chsg== X-Gm-Message-State: AOAM530KlFlUOzmepRUARXEe4SZNlQTkB2ucLoWxGAgwD31kqjazWbOl Zk/Q5DdRoEDaO1YyqknKzIQ= X-Received: by 2002:a17:90a:e017:: with SMTP id u23mr14180720pjy.179.1593622391684; Wed, 01 Jul 2020 09:53:11 -0700 (PDT) Received: from varodek.iballbatonwifi.com ([103.105.153.57]) by smtp.gmail.com with ESMTPSA id g140sm6297437pfb.48.2020.07.01.09.53.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2020 09:53:11 -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 v2 05/11] liquidio: use generic power management Date: Wed, 1 Jul 2020 22:20:51 +0530 Message-Id: <20200701165057.667799-6-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200701165057.667799-1-vaibhavgupta40@gmail.com> References: <20200701165057.667799-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 Drivers should not use legacy power management as they have to manage power states and related operations, for the device, themselves. This driver was handling them with the help of PCI helper functions. With generic PM, all essentials will be handled by the PCI core. Driver needs to do only device-specific operations. The driver defined empty-body .suspend() and .resume() callbacks earlier. They can now be define NULL and bind with "struct dev_pm_ops" variable. Compile-tested only. Signed-off-by: Vaibhav Gupta --- .../net/ethernet/cavium/liquidio/lio_main.c | 31 +++---------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c index 66d31c018c7e..19689d72bc4e 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c @@ -405,27 +405,8 @@ static void liquidio_pcie_resume(struct pci_dev *pdev __attribute__((unused))) /* Nothing to be done here. */ } -#ifdef CONFIG_PM -/** - * \brief called when suspending - * @param pdev Pointer to PCI device - * @param state state to suspend to - */ -static int liquidio_suspend(struct pci_dev *pdev __attribute__((unused)), - pm_message_t state __attribute__((unused))) -{ - return 0; -} - -/** - * \brief called when resuming - * @param pdev Pointer to PCI device - */ -static int liquidio_resume(struct pci_dev *pdev __attribute__((unused))) -{ - return 0; -} -#endif +#define liquidio_suspend NULL +#define liquidio_resume NULL /* For PCI-E Advanced Error Recovery (AER) Interface */ static const struct pci_error_handlers liquidio_err_handler = { @@ -451,17 +432,15 @@ static const struct pci_device_id liquidio_pci_tbl[] = { }; MODULE_DEVICE_TABLE(pci, liquidio_pci_tbl); +static SIMPLE_DEV_PM_OPS(liquidio_pm_ops, liquidio_suspend, liquidio_resume); + static struct pci_driver liquidio_pci_driver = { .name = "LiquidIO", .id_table = liquidio_pci_tbl, .probe = liquidio_probe, .remove = liquidio_remove, .err_handler = &liquidio_err_handler, /* For AER */ - -#ifdef CONFIG_PM - .suspend = liquidio_suspend, - .resume = liquidio_resume, -#endif + .driver.pm = &liquidio_pm_ops, #ifdef CONFIG_PCI_IOV .sriov_configure = liquidio_enable_sriov, #endif -- 2.27.0