From patchwork Mon Nov 2 16:47:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Gupta X-Patchwork-Id: 315397 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52AE3C388F2 for ; Mon, 2 Nov 2020 16:50:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 007CB222B9 for ; Mon, 2 Nov 2020 16:50:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="o1vVtcE0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727185AbgKBQub (ORCPT ); Mon, 2 Nov 2020 11:50:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727150AbgKBQua (ORCPT ); Mon, 2 Nov 2020 11:50:30 -0500 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 B35C5C0617A6; Mon, 2 Nov 2020 08:50:30 -0800 (PST) Received: by mail-pl1-x644.google.com with SMTP id t6so7084486plq.11; Mon, 02 Nov 2020 08:50:30 -0800 (PST) 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=eVI1RgdCTcgKOQYTeMJvf6pf7gm9DRT8JtIKidpJzFw=; b=o1vVtcE0URMlblenBRnxhQv+WgM1/34H7ENf+T6jvqYNL4Ji1VBlKPS1oMXYJ2aWyW NK/DV4SRSh+J8EOC3I9/1kRBQ7wyBgPQ9no4+U5sAsh42ryw8q3tsj7U8yvGUk1wOars qZt5hZUX15fvSrC6TLoj51YQu4QNGkj+OSo85oiqugyIKxty5w9yQm+q2f3eCusPsW1Z PBnu+O5hefQXc+E8y0mVQEjw45gBPEfvgCxuGmJEWOMe3N8nabHRI98VwK8wkURnJSxw eaAqYKq6AxzOfK3c6K9bSQ/NCf6gE11ArGXN3Izlko1WekyG2IkiVys9EO6Lo5DzzIBz P/Ag== 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=eVI1RgdCTcgKOQYTeMJvf6pf7gm9DRT8JtIKidpJzFw=; b=YOmLZxn0BQl5RPxxzI47h+zfkYBdxHnkDD9XPFHpj3H+YOZ0KH7bD16jBCpiF76giD bQlbxIWWl1/9MYHG9tGGdpcskkvG5PTDqsgEjOMOiLwq/mIlujcYy+LR93HXDQAchPcw wiPJvv5CDPBP+8s694b5Bs0wZoqPRMpAsw0UQfaK4qdKOXYSMspSdWHHRW7TJQviqKr+ Q1iZp/0mlJE9XogmhxeeImelMw1fSO7HRYa5YI66AkUnNLsIdzy7MyYBKdX2U6wW1ZKC gWmTTyDKRscCKO6ELOjMSPqr/Tvil1COj0kss3oGdYrh3B49Z96MUMs0rbyWqdzmLFJg GT9A== X-Gm-Message-State: AOAM532rRysNk9GhXpB9gCQnnjLDL/9R5x+pjQ4vaShJyiBko1k5WiUN j1LWayV539rqIJ2Ovpmp38Y= X-Google-Smtp-Source: ABdhPJw5fJDnITTvgjuL1NAJKSK4gc4d1RYAkQ7nw/AjwjVz99aLStx0ZElhrmau4lJ+iSxFQEjLvg== X-Received: by 2002:a17:902:6909:b029:d6:6ec4:e1f7 with SMTP id j9-20020a1709026909b02900d66ec4e1f7mr14716425plk.40.1604335830255; Mon, 02 Nov 2020 08:50:30 -0800 (PST) Received: from varodek.localdomain ([223.179.149.110]) by smtp.gmail.com with ESMTPSA id t74sm4953233pfc.47.2020.11.02.08.50.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 08:50:29 -0800 (PST) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , Bjorn Helgaas , Vaibhav Gupta , Adam Radford , "James E.J. Bottomley" , "Martin K. Petersen" , Adaptec OEM Raid Solutions , Hannes Reinecke , Bradley Grove , John Garry , Don Brace , Xiang Chen , James Smart , Dick Kennedy , Kashyap Desai , Sumit Saxena , Shivasharan S , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , Jack Wang , Balsundar P Cc: Vaibhav Gupta , Shuah Khan , linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-scsi@vger.kernel.org, esc.storagedev@microsemi.com, megaraidlinux.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH v4 01/29] scsi: megaraid_sas: Drop PCI wakeup calls from .resume Date: Mon, 2 Nov 2020 22:17:02 +0530 Message-Id: <20201102164730.324035-2-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102164730.324035-1-vaibhavgupta40@gmail.com> References: <20201102164730.324035-1-vaibhavgupta40@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The driver calls pci_enable_wake(...., false) in megasas_resume(), and there is no corresponding pci_enable_wake(...., true) in megasas_suspend(). Either it should do enable-wake the device in .suspend() or should not invoke pci_enable_wake() at all. Concluding that this driver doesn't support enable-wake and PCI core calls pci_enable_wake(pci_dev, PCI_D0, false) during resume, drop it from megasas_resume(). Signed-off-by: Vaibhav Gupta --- drivers/scsi/megaraid/megaraid_sas_base.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 41cd66fc7d81..47ffdada541d 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -7668,7 +7668,6 @@ megasas_resume(struct pci_dev *pdev) host = instance->host; pci_set_power_state(pdev, PCI_D0); - pci_enable_wake(pdev, PCI_D0, 0); pci_restore_state(pdev); dev_info(&pdev->dev, "%s is called\n", __func__); From patchwork Mon Nov 2 16:47:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Gupta X-Patchwork-Id: 315396 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2170CC4742C for ; Mon, 2 Nov 2020 16:50:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C5B8722277 for ; Mon, 2 Nov 2020 16:50:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FWH9UY/w" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727307AbgKBQux (ORCPT ); Mon, 2 Nov 2020 11:50:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727300AbgKBQuv (ORCPT ); Mon, 2 Nov 2020 11:50:51 -0500 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CA25C0617A6; Mon, 2 Nov 2020 08:50:51 -0800 (PST) Received: by mail-pl1-x62b.google.com with SMTP id r10so7110864plx.3; Mon, 02 Nov 2020 08:50:51 -0800 (PST) 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=6vxmT3Q80RGrzEju3iFEpX/Dlj35TxSTYI0m/9BGYRs=; b=FWH9UY/wDTqHTqNDW/pn8h2yIfmsgHS21dYTh1aHdf8cUOHfnUFegf8yn4WRjjWGaH joAdmrRXOGEPJub/iSdpNMLi3lokD5WjHwC7k6ubgycdjzBFcw0+CbbaxCMVPRI6n8ML CY5AE4/7irrONltr1KZNZUnHRB3XLAjcDnAHaEtizk/QyoQZLPhexwozPopzFdSnocqR nlkTnvEIyEbP/sJTUBWxMiVnt1vA2HAc860zNARXrW0dlskPnVvCA/UJxJb0gd36o6pf YIJbquACBnknKIgAWfALmem9Up0DMD7OBWOCKDhEByXNdWHQ6L1SYiIhbwatDrEychsg SJ1w== 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=6vxmT3Q80RGrzEju3iFEpX/Dlj35TxSTYI0m/9BGYRs=; b=rRDxakJdEpKP4b/PSXa78G3xWMNOqBwqx78tNPKP56XNiBf/qE+81Dcz3aSqqRi3oM /h+YOz87c7UjviH4O2KHEhFlT3k4Gz/SobPEDRRncEn6jgLpP0qmr2Zf67cYQeSrdOU7 NgDXrYcU4t0GggJ8ewYvNI45k2ZeELJD4bJJVbFsaW9w1vdr9ktS5aXRCIWf6LphOkCJ TQoBsCBEmU3rTZ4J/aR+ffWNO+38wKS5BL18pCal31ejNyi9HcAGdd0ZrUr2I18db7JZ mAJ0/yXcjwKTtwV1P9wi3yUZuJ1VDsfA5SeNqrzy20cW7rmC9ei0QFN36r0+eiXROKt7 KYug== X-Gm-Message-State: AOAM531m7GNdm6dD0FZ3lezBzMKwCPracN8UJk1QH/6aJelGnQprJV2U 2C0oTZIuUIh6j+uJcLm0aiw= X-Google-Smtp-Source: ABdhPJz92w4o9HyAGBIzrllFPmwzHVzYzCAtkRWAXWpfppLSfftceomQcU1lQHfBjVjZXUoUlHfUJA== X-Received: by 2002:a17:902:8504:b029:d6:7552:19ab with SMTP id bj4-20020a1709028504b02900d6755219abmr22151785plb.83.1604335850971; Mon, 02 Nov 2020 08:50:50 -0800 (PST) Received: from varodek.localdomain ([223.179.149.110]) by smtp.gmail.com with ESMTPSA id t74sm4953233pfc.47.2020.11.02.08.50.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 08:50:50 -0800 (PST) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , Bjorn Helgaas , Vaibhav Gupta , Adam Radford , "James E.J. Bottomley" , "Martin K. Petersen" , Adaptec OEM Raid Solutions , Hannes Reinecke , Bradley Grove , John Garry , Don Brace , Xiang Chen , James Smart , Dick Kennedy , Kashyap Desai , Sumit Saxena , Shivasharan S , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , Jack Wang , Balsundar P Cc: Vaibhav Gupta , Shuah Khan , linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-scsi@vger.kernel.org, esc.storagedev@microsemi.com, megaraidlinux.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH v4 03/29] scsi: megaraid_sas: update function description Date: Mon, 2 Nov 2020 22:17:04 +0530 Message-Id: <20201102164730.324035-4-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102164730.324035-1-vaibhavgupta40@gmail.com> References: <20201102164730.324035-1-vaibhavgupta40@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Function parameter 'pdev 'is described as Generic Device Structure. It is a PCI device structure. Signed-off-by: Vaibhav Gupta --- drivers/scsi/megaraid/megaraid_sas_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index bd330ea4063a..7384c8e9149d 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -7958,7 +7958,7 @@ static void megasas_detach_one(struct pci_dev *pdev) /** * megasas_shutdown - Shutdown entry point - * @pdev: Generic device structure + * @pdev: PCI device structure */ static void megasas_shutdown(struct pci_dev *pdev) { From patchwork Mon Nov 2 16:47:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Gupta X-Patchwork-Id: 315395 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5935DC55178 for ; Mon, 2 Nov 2020 16:51:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 12AF122268 for ; Mon, 2 Nov 2020 16:51:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eP3P0NhL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727320AbgKBQvW (ORCPT ); Mon, 2 Nov 2020 11:51:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727163AbgKBQvW (ORCPT ); Mon, 2 Nov 2020 11:51:22 -0500 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AE6FC0617A6; Mon, 2 Nov 2020 08:51:22 -0800 (PST) Received: by mail-pf1-x443.google.com with SMTP id x13so11592870pfa.9; Mon, 02 Nov 2020 08:51:22 -0800 (PST) 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=AdqDqmNu7Nx1PvYYi5OdlW5q1lUoCI4j4VahjSwyvEk=; b=eP3P0NhLcYeng6TK2EUujst4SvydxCeEyCUntT9SC6+LJvk6QHykhuueH6/pLI8gt1 JK7o+Kf5mqLx1NcJLWDCG81IPiUgEJzCPPLtLgwaHSyovtvH7t3P8pTlNcMnjcTjGJv9 Sl2bEk60Inn362/57NiowC+hgrvZCsYgGpWKA3TpQy5EG1WgSY/wjcIkGWi7KygKi+Go MdogMoJxegrgr530XGi0i+9ipmhRgpmpNaQtQ2zTd10tixdh97xB35Wtgssel8g+y1NP dxSTp4MoY8BZNBAcF8fwWGesVuDEB5NTgvzoAth0AhvFL1WdJIzmQ4Rpiv0vxnTiyiVo G8aA== 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=AdqDqmNu7Nx1PvYYi5OdlW5q1lUoCI4j4VahjSwyvEk=; b=INqBhtpPa/47P8iwMajcDBvxlsJt4bnBz61LcV/kOIBrKeDbdQEvWHiQlmtEhwdWj+ ZIcaskQ0/W/E9FrekbpMLwtfm5jrvJ0nsghObhZDRlqJD2lhpXC8cySCuEGmSuZsULvp fiSrnKiwb+cM4sf6V+S506ShHY81pWn0CReFvt6+9+94VVywhvIOQw4dn2u//OeJpKcO YP97kXvaoqY/6dEg2zn0FrxvHeVmkuWL0gYIXr6JZ9mjLmLMR55ZeKPJnO1Wy4ZcWPm0 6XKx72EjdL9HW9m6Y9dy3GkYwev9XfII1yZ1Jlti/WscHNYsCZNLKxmY2FG/IFzZRmRE 947g== X-Gm-Message-State: AOAM531DJoNZ4vKPzpKdKWkLZCMQJ5HdAaJ/Zz23LMG83iX5ASiGfT8D AG8XRlk2bPaEP6OlwAXLd5A= X-Google-Smtp-Source: ABdhPJw3oohovIVzEW6Lk1KewPzZqifa78hPzZ3VGJMa6114i8blFub1+pk+Izdv8VuHVrnlf8bR7w== X-Received: by 2002:a63:4556:: with SMTP id u22mr3179533pgk.261.1604335882067; Mon, 02 Nov 2020 08:51:22 -0800 (PST) Received: from varodek.localdomain ([223.179.149.110]) by smtp.gmail.com with ESMTPSA id t74sm4953233pfc.47.2020.11.02.08.51.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 08:51:21 -0800 (PST) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , Bjorn Helgaas , Vaibhav Gupta , Adam Radford , "James E.J. Bottomley" , "Martin K. Petersen" , Adaptec OEM Raid Solutions , Hannes Reinecke , Bradley Grove , John Garry , Don Brace , Xiang Chen , James Smart , Dick Kennedy , Kashyap Desai , Sumit Saxena , Shivasharan S , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , Jack Wang , Balsundar P Cc: Vaibhav Gupta , Shuah Khan , linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-scsi@vger.kernel.org, esc.storagedev@microsemi.com, megaraidlinux.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH v4 05/29] scsi: aacraid: use generic power management Date: Mon, 2 Nov 2020 22:17:06 +0530 Message-Id: <20201102164730.324035-6-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102164730.324035-1-vaibhavgupta40@gmail.com> References: <20201102164730.324035-1-vaibhavgupta40@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Drivers should do only device-specific jobs. But in general, drivers using legacy PCI PM framework for .suspend()/.resume() have to manage many PCI PM-related tasks themselves which can be done by PCI Core itself. This brings extra load on the driver and it directly calls PCI helper functions to handle them. Switch to the new generic framework by updating function signatures and define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove unnecessary calls to the PCI Helper functions along with the legacy .suspend & .resume bindings. Signed-off-by: Vaibhav Gupta Acked-by: Balsundar P --- drivers/scsi/aacraid/linit.c | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 8c4dcb5ab329..5177d387854a 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c @@ -1910,11 +1910,9 @@ static int aac_acquire_resources(struct aac_dev *dev) } -#if (defined(CONFIG_PM)) -static int aac_suspend(struct pci_dev *pdev, pm_message_t state) +static int __maybe_unused aac_suspend(struct device *dev) { - - struct Scsi_Host *shost = pci_get_drvdata(pdev); + struct Scsi_Host *shost = dev_get_drvdata(dev); struct aac_dev *aac = (struct aac_dev *)shost->hostdata; scsi_host_block(shost); @@ -1923,28 +1921,14 @@ static int aac_suspend(struct pci_dev *pdev, pm_message_t state) aac_release_resources(aac); - pci_set_drvdata(pdev, shost); - pci_save_state(pdev); - pci_disable_device(pdev); - pci_set_power_state(pdev, pci_choose_state(pdev, state)); - return 0; } -static int aac_resume(struct pci_dev *pdev) +static int __maybe_unused aac_resume(struct device *dev) { - struct Scsi_Host *shost = pci_get_drvdata(pdev); + struct Scsi_Host *shost = dev_get_drvdata(dev); struct aac_dev *aac = (struct aac_dev *)shost->hostdata; - int r; - - pci_set_power_state(pdev, PCI_D0); - pci_restore_state(pdev); - r = pci_enable_device(pdev); - - if (r) - goto fail_device; - pci_set_master(pdev); if (aac_acquire_resources(aac)) goto fail_device; /* @@ -1959,10 +1943,8 @@ static int aac_resume(struct pci_dev *pdev) fail_device: printk(KERN_INFO "%s%d: resume failed.\n", aac->name, aac->id); scsi_host_put(shost); - pci_disable_device(pdev); return -ENODEV; } -#endif static void aac_shutdown(struct pci_dev *dev) { @@ -2107,15 +2089,14 @@ static struct pci_error_handlers aac_pci_err_handler = { .resume = aac_pci_resume, }; +static SIMPLE_DEV_PM_OPS(aac_pm_ops, aac_suspend, aac_resume); + static struct pci_driver aac_pci_driver = { .name = AAC_DRIVERNAME, .id_table = aac_pci_tbl, .probe = aac_probe_one, .remove = aac_remove_one, -#if (defined(CONFIG_PM)) - .suspend = aac_suspend, - .resume = aac_resume, -#endif + .driver.pm = &aac_pm_ops, .shutdown = aac_shutdown, .err_handler = &aac_pci_err_handler, }; From patchwork Mon Nov 2 16:47:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Gupta X-Patchwork-Id: 315394 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45FA4C00A89 for ; Mon, 2 Nov 2020 16:51:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D39B522258 for ; Mon, 2 Nov 2020 16:51:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="o0+RixOC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727359AbgKBQvv (ORCPT ); Mon, 2 Nov 2020 11:51:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726788AbgKBQvv (ORCPT ); Mon, 2 Nov 2020 11:51:51 -0500 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00E2BC0617A6; Mon, 2 Nov 2020 08:51:51 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id t14so11302851pgg.1; Mon, 02 Nov 2020 08:51:50 -0800 (PST) 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=cJtPRbZ0BXTdxtMhOPuwVb993Cdrsr394jXmvtsCRXA=; b=o0+RixOC4+HHVj6IcZW2lxk7rwbti9/GvAsbGq27zORpiX5cG1FvjlbbRWCKcbJiGF Vs7IsnKkJmM+36NfFuYKo0L/FCmh5goFm0hzMpe0Za4SjFFM3gCI/B+6R/JTnHpXZd2b stDzegLSVxEFArvrp3VAWZe5KYgISU8AIzLnWGuIBsYBc7jtP3/YdXvAxDgQ/BD0xbNR VffUwUPEFHNLZIwOUeY2IULJ/p+Sx3J5mfIGQaU2LFOX+Ka1KZfyzy3cU8QWj65H0feQ 6b0X51LFE8QhjNwEqiWg0v0/CdO8DpJm429usdwVCb6f16jfJWt8B2cauQEKTumyCj7d SAEg== 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=cJtPRbZ0BXTdxtMhOPuwVb993Cdrsr394jXmvtsCRXA=; b=PyjT0+lGOR10AGZJonwyOrG/XtGhrY+r8eua4Zhr29B/ZwUoD82HJsXXFQecRVwrqj Gml0HJ/Po8qRT/cC0FUrZvPe7XiUWDx3D3jnsiVti0xYCFOyghJiZPJc3HYFwlinM1gU /fr5chgBXVVsu7YcGGCrlYHop/03TNj8cqvwV44g/HfavCxYCgzywdfo6SVn7NYCkuCX TzfKNflVKtYaJeUB2ieSBjvmhgtGFVJ/MBqQRKpexnV02mKsSTHe+YG8CdIx9rrYxP4C Vzfo1rBD2Yh4wmXZ0zrEq6s+NPd1tthX+RXwUvbbWGqn7iByuqrbYZagAL4XjM1EPQDi LXLA== X-Gm-Message-State: AOAM53083nEjdZ/lI5Rd8h9bzoXvnbUjXq6C9p7MULXb44bhAdeP8/XB drDu8JgSmlynxby5me3L0HY= X-Google-Smtp-Source: ABdhPJwMkLBsyBK8ShkMbKcFNpZL8/RhL7F9NjCxS+3MHLcgt2hVh7/aAb8+Yaa5TiGJGPB9d9fgfA== X-Received: by 2002:a63:d66:: with SMTP id 38mr13160055pgn.400.1604335910487; Mon, 02 Nov 2020 08:51:50 -0800 (PST) Received: from varodek.localdomain ([223.179.149.110]) by smtp.gmail.com with ESMTPSA id t74sm4953233pfc.47.2020.11.02.08.51.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 08:51:50 -0800 (PST) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , Bjorn Helgaas , Vaibhav Gupta , Adam Radford , "James E.J. Bottomley" , "Martin K. Petersen" , Adaptec OEM Raid Solutions , Hannes Reinecke , Bradley Grove , John Garry , Don Brace , Xiang Chen , James Smart , Dick Kennedy , Kashyap Desai , Sumit Saxena , Shivasharan S , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , Jack Wang , Balsundar P Cc: Vaibhav Gupta , Shuah Khan , linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-scsi@vger.kernel.org, esc.storagedev@microsemi.com, megaraidlinux.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH v4 07/29] scsi: aic79xx: use generic power management Date: Mon, 2 Nov 2020 22:17:08 +0530 Message-Id: <20201102164730.324035-8-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102164730.324035-1-vaibhavgupta40@gmail.com> References: <20201102164730.324035-1-vaibhavgupta40@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Drivers should do only device-specific jobs. But in general, drivers using legacy PCI PM framework for .suspend()/.resume() have to manage many PCI PM-related tasks themselves which can be done by PCI Core itself. This brings extra load on the driver and it directly calls PCI helper functions to handle them. Switch to the new generic framework by updating function signatures and define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove unnecessary calls to the PCI Helper functions along with the legacy .suspend & .resume bindings. Signed-off-by: Vaibhav Gupta --- drivers/scsi/aic7xxx/aic79xx.h | 12 +++---- drivers/scsi/aic7xxx/aic79xx_core.c | 8 ++--- drivers/scsi/aic7xxx/aic79xx_osm_pci.c | 43 +++++++------------------- drivers/scsi/aic7xxx/aic79xx_pci.c | 6 ++-- 4 files changed, 20 insertions(+), 49 deletions(-) diff --git a/drivers/scsi/aic7xxx/aic79xx.h b/drivers/scsi/aic7xxx/aic79xx.h index 9a515551641c..dd5dfd4f30a5 100644 --- a/drivers/scsi/aic7xxx/aic79xx.h +++ b/drivers/scsi/aic7xxx/aic79xx.h @@ -1330,10 +1330,8 @@ const struct ahd_pci_identity *ahd_find_pci_device(ahd_dev_softc_t); int ahd_pci_config(struct ahd_softc *, const struct ahd_pci_identity *); int ahd_pci_test_register_access(struct ahd_softc *); -#ifdef CONFIG_PM -void ahd_pci_suspend(struct ahd_softc *); -void ahd_pci_resume(struct ahd_softc *); -#endif +void __maybe_unused ahd_pci_suspend(struct ahd_softc *); +void __maybe_unused ahd_pci_resume(struct ahd_softc *); /************************** SCB and SCB queue management **********************/ void ahd_qinfifo_requeue_tail(struct ahd_softc *ahd, @@ -1344,10 +1342,8 @@ struct ahd_softc *ahd_alloc(void *platform_arg, char *name); int ahd_softc_init(struct ahd_softc *); void ahd_controller_info(struct ahd_softc *ahd, char *buf); int ahd_init(struct ahd_softc *ahd); -#ifdef CONFIG_PM -int ahd_suspend(struct ahd_softc *ahd); -void ahd_resume(struct ahd_softc *ahd); -#endif +int __maybe_unused ahd_suspend(struct ahd_softc *ahd); +void __maybe_unused ahd_resume(struct ahd_softc *ahd); int ahd_default_config(struct ahd_softc *ahd); int ahd_parse_vpddata(struct ahd_softc *ahd, struct vpd_config *vpd); diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c index 98b02e7d38bb..78560a85b1e3 100644 --- a/drivers/scsi/aic7xxx/aic79xx_core.c +++ b/drivers/scsi/aic7xxx/aic79xx_core.c @@ -7866,11 +7866,9 @@ ahd_pause_and_flushwork(struct ahd_softc *ahd) ahd->flags &= ~AHD_ALL_INTERRUPTS; } -#ifdef CONFIG_PM -int +int __maybe_unused ahd_suspend(struct ahd_softc *ahd) { - ahd_pause_and_flushwork(ahd); if (LIST_FIRST(&ahd->pending_scbs) != NULL) { @@ -7881,15 +7879,13 @@ ahd_suspend(struct ahd_softc *ahd) return (0); } -void +void __maybe_unused ahd_resume(struct ahd_softc *ahd) { - ahd_reset(ahd, /*reinit*/TRUE); ahd_intr_enable(ahd, TRUE); ahd_restart(ahd); } -#endif /************************** Busy Target Table *********************************/ /* diff --git a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c index 8b891a05d9e7..07b670b80f1b 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c @@ -74,11 +74,10 @@ static const struct pci_device_id ahd_linux_pci_id_table[] = { MODULE_DEVICE_TABLE(pci, ahd_linux_pci_id_table); -#ifdef CONFIG_PM -static int -ahd_linux_pci_dev_suspend(struct pci_dev *pdev, pm_message_t mesg) +static int __maybe_unused +ahd_linux_pci_dev_suspend(struct device *dev) { - struct ahd_softc *ahd = pci_get_drvdata(pdev); + struct ahd_softc *ahd = dev_get_drvdata(dev); int rc; if ((rc = ahd_suspend(ahd))) @@ -86,39 +85,20 @@ ahd_linux_pci_dev_suspend(struct pci_dev *pdev, pm_message_t mesg) ahd_pci_suspend(ahd); - pci_save_state(pdev); - pci_disable_device(pdev); - - if (mesg.event & PM_EVENT_SLEEP) - pci_set_power_state(pdev, PCI_D3hot); - return rc; } -static int -ahd_linux_pci_dev_resume(struct pci_dev *pdev) +static int __maybe_unused +ahd_linux_pci_dev_resume(struct device *dev) { - struct ahd_softc *ahd = pci_get_drvdata(pdev); - int rc; - - pci_set_power_state(pdev, PCI_D0); - pci_restore_state(pdev); - - if ((rc = pci_enable_device(pdev))) { - dev_printk(KERN_ERR, &pdev->dev, - "failed to enable device after resume (%d)\n", rc); - return rc; - } - - pci_set_master(pdev); + struct ahd_softc *ahd = dev_get_drvdata(dev); ahd_pci_resume(ahd); ahd_resume(ahd); - return rc; + return 0; } -#endif static void ahd_linux_pci_dev_remove(struct pci_dev *pdev) @@ -224,13 +204,14 @@ ahd_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return (0); } +static SIMPLE_DEV_PM_OPS(ahd_linux_pci_dev_pm_ops, + ahd_linux_pci_dev_suspend, + ahd_linux_pci_dev_resume); + static struct pci_driver aic79xx_pci_driver = { .name = "aic79xx", .probe = ahd_linux_pci_dev_probe, -#ifdef CONFIG_PM - .suspend = ahd_linux_pci_dev_suspend, - .resume = ahd_linux_pci_dev_resume, -#endif + .driver.pm = &ahd_linux_pci_dev_pm_ops, .remove = ahd_linux_pci_dev_remove, .id_table = ahd_linux_pci_id_table }; diff --git a/drivers/scsi/aic7xxx/aic79xx_pci.c b/drivers/scsi/aic7xxx/aic79xx_pci.c index 8397ae93f7dd..2f0bdb9225a4 100644 --- a/drivers/scsi/aic7xxx/aic79xx_pci.c +++ b/drivers/scsi/aic7xxx/aic79xx_pci.c @@ -377,8 +377,7 @@ ahd_pci_config(struct ahd_softc *ahd, const struct ahd_pci_identity *entry) return ahd_pci_map_int(ahd); } -#ifdef CONFIG_PM -void +void __maybe_unused ahd_pci_suspend(struct ahd_softc *ahd) { /* @@ -394,7 +393,7 @@ ahd_pci_suspend(struct ahd_softc *ahd) } -void +void __maybe_unused ahd_pci_resume(struct ahd_softc *ahd) { ahd_pci_write_config(ahd->dev_softc, DEVCONFIG, @@ -404,7 +403,6 @@ ahd_pci_resume(struct ahd_softc *ahd) ahd_pci_write_config(ahd->dev_softc, CSIZE_LATTIME, ahd->suspend_state.pci_state.csize_lattime, /*bytes*/1); } -#endif /* * Perform some simple tests that should catch situations where From patchwork Mon Nov 2 16:47:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Gupta X-Patchwork-Id: 315393 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70E7AC00A89 for ; Mon, 2 Nov 2020 16:52:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3263D22268 for ; Mon, 2 Nov 2020 16:52:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IdnDTo/Z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727384AbgKBQwQ (ORCPT ); Mon, 2 Nov 2020 11:52:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727209AbgKBQwQ (ORCPT ); Mon, 2 Nov 2020 11:52:16 -0500 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47265C0617A6; Mon, 2 Nov 2020 08:52:16 -0800 (PST) Received: by mail-pf1-x442.google.com with SMTP id 13so11607330pfy.4; Mon, 02 Nov 2020 08:52:16 -0800 (PST) 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=ZfFrvqo7DqkFljFYrfz490r27HiLjLHSzp/wVexiQxI=; b=IdnDTo/Z15gQQJenXHbz48rYyZ/viY+gIX4WeuWdw9YrvB5qHMPlW9Isvh8v/xjYQI 0kWZQNPsIkfFdOAjHYKP+c03Rh33P4ZJMStTRU1josXmDvOOc1vNyzmuUFxBPB3Qdrc5 ljpB3kLsnIHr0K044vjKgn0TpYJNwEvJt1tPcQgSCiUkMgdXAfiOH5cF9qXnOEKUWD0P hGkzzS9vDdqsfIS15adkZY7sb3CkU/GjCpwUppvlmyAxLmQk0jhk08kZzv2Qr9evE1jI TysSsLBvylG7r7fpMdwCYyLH6l4ofk8UcOAi2WaYRI4+4shSaRYRXhoZ0ONrcbsaK5OE I9sQ== 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=ZfFrvqo7DqkFljFYrfz490r27HiLjLHSzp/wVexiQxI=; b=EnpL0T4Wuv54VK67AsdQdr/VWyY/hdBvaLOgovv2hAr9TgAXJsQY5Z1hiMFmzOyCs0 5LsKd2qsqKtTKQf0UFgKwdI8bde8v4exAHaJ+Y3dVLBg/YJmCmM13omguTDeJJkRyxxe Ep3EJnDJxGuav5hWFQ3Esd4YxwSGOoaW5B3LmCFHTy1w/MX/Q2aMHDqoS51vJGc/+ycP oBU75ZqBxQfrb9VCmc0MUJK/kI8cACK3CI6A8O8C14cDvjLvVr3Gj85GDkBvAbTkc2dY P5zCsWpND9zqI4rP4wRoSXrzBWSsqfEgrD1xLOpn12gViA5OO/FtkCgJJ4t9wwLD8yxb fB5w== X-Gm-Message-State: AOAM530o4Rs5WE/8Tdfi97P2kDZXz3GDm2uDcz/bpufOoeUhXr7NjnCX rP7rGNPuxZ83tAZ892+NkzE= X-Google-Smtp-Source: ABdhPJzoB/aS3l59wiqAH8Fub2lfPofKLh5dv3O7rn/FPpOZWCaLVIp6hFC00Sx3oLNCUw1fY3Zkqw== X-Received: by 2002:a17:90a:8b93:: with SMTP id z19mr11878765pjn.123.1604335935795; Mon, 02 Nov 2020 08:52:15 -0800 (PST) Received: from varodek.localdomain ([223.179.149.110]) by smtp.gmail.com with ESMTPSA id t74sm4953233pfc.47.2020.11.02.08.52.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 08:52:15 -0800 (PST) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , Bjorn Helgaas , Vaibhav Gupta , Adam Radford , "James E.J. Bottomley" , "Martin K. Petersen" , Adaptec OEM Raid Solutions , Hannes Reinecke , Bradley Grove , John Garry , Don Brace , Xiang Chen , James Smart , Dick Kennedy , Kashyap Desai , Sumit Saxena , Shivasharan S , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , Jack Wang , Balsundar P Cc: Vaibhav Gupta , Shuah Khan , linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-scsi@vger.kernel.org, esc.storagedev@microsemi.com, megaraidlinux.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH v4 09/29] scsi: arcmsr: use generic power management Date: Mon, 2 Nov 2020 22:17:10 +0530 Message-Id: <20201102164730.324035-10-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102164730.324035-1-vaibhavgupta40@gmail.com> References: <20201102164730.324035-1-vaibhavgupta40@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Drivers should do only device-specific jobs. But in general, drivers using legacy PCI PM framework for .suspend()/.resume() have to manage many PCI PM-related tasks themselves which can be done by PCI Core itself. This brings extra load on the driver and it directly calls PCI helper functions to handle them. Switch to the new generic framework by updating function signatures and define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove unnecessary calls to the PCI Helper functions along with the legacy .suspend & .resume bindings. Signed-off-by: Vaibhav Gupta --- drivers/scsi/arcmsr/arcmsr_hba.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c index c7ba4cbd197b..907f5af3bbd4 100644 --- a/drivers/scsi/arcmsr/arcmsr_hba.c +++ b/drivers/scsi/arcmsr/arcmsr_hba.c @@ -113,8 +113,8 @@ static int arcmsr_bios_param(struct scsi_device *sdev, static int arcmsr_queue_command(struct Scsi_Host *h, struct scsi_cmnd *cmd); static int arcmsr_probe(struct pci_dev *pdev, const struct pci_device_id *id); -static int arcmsr_suspend(struct pci_dev *pdev, pm_message_t state); -static int arcmsr_resume(struct pci_dev *pdev); +static int __maybe_unused arcmsr_suspend(struct device *dev); +static int __maybe_unused arcmsr_resume(struct device *dev); static void arcmsr_remove(struct pci_dev *pdev); static void arcmsr_shutdown(struct pci_dev *pdev); static void arcmsr_iop_init(struct AdapterControlBlock *acb); @@ -216,13 +216,14 @@ static struct pci_device_id arcmsr_device_id_table[] = { }; MODULE_DEVICE_TABLE(pci, arcmsr_device_id_table); +static SIMPLE_DEV_PM_OPS(arcmsr_pm_ops, arcmsr_suspend, arcmsr_resume); + static struct pci_driver arcmsr_pci_driver = { .name = "arcmsr", .id_table = arcmsr_device_id_table, .probe = arcmsr_probe, .remove = arcmsr_remove, - .suspend = arcmsr_suspend, - .resume = arcmsr_resume, + .driver.pm = &arcmsr_pm_ops, .shutdown = arcmsr_shutdown, }; /* @@ -1126,8 +1127,9 @@ static void arcmsr_free_irq(struct pci_dev *pdev, pci_free_irq_vectors(pdev); } -static int arcmsr_suspend(struct pci_dev *pdev, pm_message_t state) +static int __maybe_unused arcmsr_suspend(struct device *dev) { + struct pci_dev *pdev = to_pci_dev(dev); struct Scsi_Host *host = pci_get_drvdata(pdev); struct AdapterControlBlock *acb = (struct AdapterControlBlock *)host->hostdata; @@ -1140,28 +1142,18 @@ static int arcmsr_suspend(struct pci_dev *pdev, pm_message_t state) flush_work(&acb->arcmsr_do_message_isr_bh); arcmsr_stop_adapter_bgrb(acb); arcmsr_flush_adapter_cache(acb); - pci_set_drvdata(pdev, host); - pci_save_state(pdev); - pci_disable_device(pdev); - pci_set_power_state(pdev, pci_choose_state(pdev, state)); return 0; } -static int arcmsr_resume(struct pci_dev *pdev) +static int __maybe_unused arcmsr_resume(struct device *dev) { + struct pci_dev *pdev = to_pci_dev(dev); struct Scsi_Host *host = pci_get_drvdata(pdev); struct AdapterControlBlock *acb = (struct AdapterControlBlock *)host->hostdata; - pci_set_power_state(pdev, PCI_D0); - pci_restore_state(pdev); - if (pci_enable_device(pdev)) { - pr_warn("%s: pci_enable_device error\n", __func__); - return -ENODEV; - } if (arcmsr_set_dma_mask(acb)) goto controller_unregister; - pci_set_master(pdev); if (arcmsr_request_irq(pdev, acb) == FAILED) goto controller_stop; switch (acb->adapter_type) { @@ -1206,9 +1198,7 @@ static int arcmsr_resume(struct pci_dev *pdev) if (acb->adapter_type == ACB_ADAPTER_TYPE_F) arcmsr_free_io_queue(acb); arcmsr_unmap_pciregion(acb); - pci_release_regions(pdev); scsi_host_put(host); - pci_disable_device(pdev); return -ENODEV; } From patchwork Mon Nov 2 16:47:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Gupta X-Patchwork-Id: 315392 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 789F5C388F2 for ; Mon, 2 Nov 2020 16:52:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 37150223FD for ; Mon, 2 Nov 2020 16:52:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BFOSE7/j" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727486AbgKBQwu (ORCPT ); Mon, 2 Nov 2020 11:52:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727484AbgKBQwq (ORCPT ); Mon, 2 Nov 2020 11:52:46 -0500 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79E1BC0617A6; Mon, 2 Nov 2020 08:52:46 -0800 (PST) Received: by mail-pg1-x543.google.com with SMTP id k9so9590462pgt.9; Mon, 02 Nov 2020 08:52:46 -0800 (PST) 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=XPMjeP+Aj8Y7qYlQVBIVXdIdvsMXyUBB2qOriiIG5lA=; b=BFOSE7/jZj6D/hNGPW6Z+IYEY9S+IxabURlympaa+oRyRRbAXjsP9s3RqWZx4J9hsI BGEE9Eq70JfosYWPtLomF9SBSuA2HBDZ02GUj+CVWcFUEBT+XVI7n7zaCr7wbCwgw6ka 3+H7Z9qVtNwMndJMN2vWnlSyc5hAqGyIR5QQN8X+2yhvSRPnaI69RmUxBdbubFTuCUIX piy3chi0KamIbGXKBG2UJ2Es5dnVCmLTvftYmI0OmGoR0vMZdTO+zQFhPSeSyRYxhBDJ KlfHKfLgq+0S1P+m6dMT7tAXfXoDIUsQHSzhmIinIKqJS2Ln4WWV+wyx2ui1xnLN3d52 V74g== 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=XPMjeP+Aj8Y7qYlQVBIVXdIdvsMXyUBB2qOriiIG5lA=; b=aSrurqFQWiQ+kB2Dx66kipoTUG+G3EXQyW4/wxKVi9utlut22q/gg54gI9mKR1eN7J Y8J57qqNmrX8iU79FYrUJIKHE3Sk/X1X7mqcR37rt1ry+AgmKFym2fS2BF8sFbSex84o MzZ22R/HykFQgo7FQ1WY9NzpoL3eat1rW6Y0GJDKCfJj1mES/jeH0ufO8Zw85760SjBf dT5mGMfZ+KR08qWJWNP41fxHkdkwQZDhpcnknnzGg0YcgWTJX7Hip49jv2zq0nJ7XGtF iD+L86Acvn8KCv+VKSGxbAIIAP3oj5W0QSy+WUFN1Ld61mIHeEbbDX9Dza3NgpApcHUW 8yWA== X-Gm-Message-State: AOAM532FctXEUjsNslvOvuiSZlY/+v/mVxMYras0OXfEbY9r3WnUuDYP wDVCocXf+86wCMAlKIlPG5E= X-Google-Smtp-Source: ABdhPJyCrllqbyiFve3kKXuwDFU8Zp7rtUgBCNHNxZtJ2bhsDm1uCIq1J9Y4X4Ue1/8Cl51gz1/Uiw== X-Received: by 2002:a17:90a:468f:: with SMTP id z15mr17777167pjf.200.1604335966065; Mon, 02 Nov 2020 08:52:46 -0800 (PST) Received: from varodek.localdomain ([223.179.149.110]) by smtp.gmail.com with ESMTPSA id t74sm4953233pfc.47.2020.11.02.08.52.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 08:52:45 -0800 (PST) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , Bjorn Helgaas , Vaibhav Gupta , Adam Radford , "James E.J. Bottomley" , "Martin K. Petersen" , Adaptec OEM Raid Solutions , Hannes Reinecke , Bradley Grove , John Garry , Don Brace , Xiang Chen , James Smart , Dick Kennedy , Kashyap Desai , Sumit Saxena , Shivasharan S , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , Jack Wang , Balsundar P Cc: Vaibhav Gupta , Shuah Khan , linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-scsi@vger.kernel.org, esc.storagedev@microsemi.com, megaraidlinux.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH v4 12/29] scsi: hisi_sas_v3_hw: Drop PCI Wakeup calls from .resume Date: Mon, 2 Nov 2020 22:17:13 +0530 Message-Id: <20201102164730.324035-13-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102164730.324035-1-vaibhavgupta40@gmail.com> References: <20201102164730.324035-1-vaibhavgupta40@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The driver calls pci_enable_wake(...., false) in hisi_sas_v3_resume(), and there is no corresponding pci_enable_wake(...., true) in hisi_sas_v3_suspend(). Either it should do enable-wake the device in .suspend() or should not invoke pci_enable_wake() at all. Concluding that this driver doesn't support enable-wake and PCI core calls pci_enable_wake(pci_dev, PCI_D0, false) during resume, drop it from hisi_sas_v3_resume(). Signed-off-by: Vaibhav Gupta --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 7133ca859b5e..f19f3db1ac6d 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -3492,7 +3492,6 @@ static int _resume_v3_hw(struct device *device) dev_warn(dev, "resuming from operating state [D%d]\n", device_state); pci_set_power_state(pdev, PCI_D0); - pci_enable_wake(pdev, PCI_D0, 0); pci_restore_state(pdev); rc = pci_enable_device(pdev); if (rc) { From patchwork Mon Nov 2 16:47:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Gupta X-Patchwork-Id: 315391 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEBFBC4742C for ; Mon, 2 Nov 2020 16:53:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B093C22258 for ; Mon, 2 Nov 2020 16:53:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="i4lK7B2j" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727384AbgKBQxA (ORCPT ); Mon, 2 Nov 2020 11:53:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727196AbgKBQw7 (ORCPT ); Mon, 2 Nov 2020 11:52:59 -0500 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 4A0F0C0617A6; Mon, 2 Nov 2020 08:52:58 -0800 (PST) Received: by mail-pf1-x444.google.com with SMTP id y14so11587475pfp.13; Mon, 02 Nov 2020 08:52:58 -0800 (PST) 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=MBzsuEUa6bYvsV+CNnIl+xHeK3YoENUVJTW96RlBScM=; b=i4lK7B2jCeWUWs/7k7aRJe2mVzCOREf/YaZphfdcnGM0u+NoaCHXT1UMtxiid1cPRk z+BPB3zIpcTUGy7gNJ+vQ+mf6T/j71u4xbBtkOpJFr0pkC7C9qKw3p0Q/5/01HSApBta Ou3O6JCnnfnkLTA7bAPGiA4KrhBxm/8fKADenbdF1J4iCL0+VyOS918WGeSy6jnLmizw gqP9jIo7nYYWjov+spMoRffy2As9Y9GUzTL5aQWpXYLgfZia0BjMUJBE8J1Or8gBFVVo F016wRV7uUCivQ4adKG5hAUXH+lhQwfZSg1Wfk102HFPrtIRVcxXRArRP+VFGN2ZB9nO alSg== 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=MBzsuEUa6bYvsV+CNnIl+xHeK3YoENUVJTW96RlBScM=; b=bipUM18rmPTrQX97TuRcxqTJVVlM3ldiB9OtaHS2o66vKrGS9Gm0qNr7LH0etVY5K5 SPjAhwU8y4YAEKTrGIc96hhlD4hA/+/zzhnJYQimMAJZc3vl8cY0+nnzgp2f1rAV8Amn QqfXMscTePQB0l7f23qk7HcFiwaj9sxiOwpXKnO0LAQEu1mLQcHLKrUq25kaXFGsh6R/ DnZU3z4GJz+9TxmUPmb7r4v2n31q411FWXaFzXTWCQevktnf9uetU1nKAzY6hs++aiIX y786XCihAkW7t97meEikuYhSoGoP2sFVJO7z2VTToyLphNzEUMXV3cmRgNR3uLgLUAyk bzHQ== X-Gm-Message-State: AOAM532uqq4HWH+zqVXLAPOQvw1n6kCiZDVgeUsiIjyLvSG3hJeo0AMj quQgZnHzDdUocDL4wgVexnk= X-Google-Smtp-Source: ABdhPJxiIXDXayIA4x2vypTJ5B2naXIVlq1IYCXlgXG2jWp3RJ2Zwiiq5D86qMZ/Pko1ZcPv4K6N1w== X-Received: by 2002:a17:90a:3e4a:: with SMTP id t10mr18207881pjm.151.1604335977846; Mon, 02 Nov 2020 08:52:57 -0800 (PST) Received: from varodek.localdomain ([223.179.149.110]) by smtp.gmail.com with ESMTPSA id t74sm4953233pfc.47.2020.11.02.08.52.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 08:52:57 -0800 (PST) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , Bjorn Helgaas , Vaibhav Gupta , Adam Radford , "James E.J. Bottomley" , "Martin K. Petersen" , Adaptec OEM Raid Solutions , Hannes Reinecke , Bradley Grove , John Garry , Don Brace , Xiang Chen , James Smart , Dick Kennedy , Kashyap Desai , Sumit Saxena , Shivasharan S , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , Jack Wang , Balsundar P Cc: Vaibhav Gupta , Shuah Khan , linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-scsi@vger.kernel.org, esc.storagedev@microsemi.com, megaraidlinux.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH v4 13/29] scsi: hisi_sas_v3_hw: Don't use PCI helper functions Date: Mon, 2 Nov 2020 22:17:14 +0530 Message-Id: <20201102164730.324035-14-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102164730.324035-1-vaibhavgupta40@gmail.com> References: <20201102164730.324035-1-vaibhavgupta40@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Drivers using new-framework/generic-framework should not handle standard power management operations. These operations were performed by legacy framework through PCI helper functions like pci_save/restore_state(), pci_set_power_state(), etc. Drivers should not use them now. Signed-off-by: Vaibhav Gupta --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index f19f3db1ac6d..dfeb86c865d3 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -3440,7 +3440,6 @@ static int _suspend_v3_hw(struct device *device) struct hisi_hba *hisi_hba = sha->lldd_ha; struct device *dev = hisi_hba->dev; struct Scsi_Host *shost = hisi_hba->shost; - pci_power_t device_state; int rc; if (!pdev->pm_cap) { @@ -3466,12 +3465,7 @@ static int _suspend_v3_hw(struct device *device) hisi_sas_init_mem(hisi_hba); - device_state = pci_choose_state(pdev, PMSG_SUSPEND); - dev_warn(dev, "entering operating state [D%d]\n", - device_state); - pci_save_state(pdev); - pci_disable_device(pdev); - pci_set_power_state(pdev, device_state); + dev_warn(dev, "entering suspend state\n"); hisi_sas_release_tasks(hisi_hba); @@ -3491,15 +3485,7 @@ static int _resume_v3_hw(struct device *device) dev_warn(dev, "resuming from operating state [D%d]\n", device_state); - pci_set_power_state(pdev, PCI_D0); - pci_restore_state(pdev); - rc = pci_enable_device(pdev); - if (rc) { - dev_err(dev, "enable device failed during resume (%d)\n", rc); - return rc; - } - pci_set_master(pdev); scsi_unblock_requests(shost); clear_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags); @@ -3507,7 +3493,6 @@ static int _resume_v3_hw(struct device *device) rc = hw_init_v3_hw(hisi_hba); if (rc) { scsi_remove_host(shost); - pci_disable_device(pdev); return rc; } hisi_hba->hw->phys_init(hisi_hba); From patchwork Mon Nov 2 16:47:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Gupta X-Patchwork-Id: 315390 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8248C00A89 for ; Mon, 2 Nov 2020 16:53:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A191F22268 for ; Mon, 2 Nov 2020 16:53:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Kl55ZSfn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727277AbgKBQxU (ORCPT ); Mon, 2 Nov 2020 11:53:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727522AbgKBQxU (ORCPT ); Mon, 2 Nov 2020 11:53:20 -0500 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 CDB30C0617A6; Mon, 2 Nov 2020 08:53:19 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id x13so11597992pfa.9; Mon, 02 Nov 2020 08:53:19 -0800 (PST) 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=SOLD0sLwTuY4TfChHkgrK5w3Qn4ds7uACuE/j2qv8aY=; b=Kl55ZSfnA/Mn6mRPbWGTEkVUeJVome2iCB4Xfr9T7sFbx+NyK9JIXu+IgS5Nd9JzVu VIIWniztcf0DJVP/1CQMsGvr4EqGMnwwNEGK/M2b7Gl0TfcJcryeDVWLN/iYumoIrO43 ADHSpvqZXrzcigImQPZNzVq6jtJj/CAOky00a8lUaOYngj4zbATM9922FCGv563HpKp2 420zs+mB01xfIaGLNNvJXAoLvO000Crd4uVftw97qkXpTpnQTlw6XJH+L3qEp1Vzeduy e1Y0xnM94DQx2YHOQ0SugTcrZcuPHU0jJ/3B6iTbhTxv0Q4cGUnh5ZUD77kF7eTV6KKt V0yw== 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=SOLD0sLwTuY4TfChHkgrK5w3Qn4ds7uACuE/j2qv8aY=; b=b09xyGseVAenFqiXgspXQ+KB0SO/IvfN6CR2QVBjrGyeoJhUS3HD1pPeHXf5mT7vbY 4tKyUzj0+tg5yMfkDFg9JFk3x/GKf2lwKcaMY3k+cacHq1oHgyqj+l84UvzdAJaeHiuT 3MKRuud0w1sZkcDbdFSuiddq/AsVq9Ci2qrAKe80kwq9HgeNokopQvsgTg9hhpiSJ3+n Iftidd6DMTD5Pc/kImElE1W/gF68vwjriCKinciecRZnMbdgpzexPe9BEeKaKbdboquF YAOlSK/S0PLTeY7J573orZPsCz3ZCItcaGgUeknOrxsRsPqzR+7AXy7a2nWKg/UQaQ/+ 9PRA== X-Gm-Message-State: AOAM5333f5sUQ3gWj37TvgZZdMxZSZhOei+nNaA+osuXXaDMkeXAYrD/ IqTXvUAcRw/sEzYf6gkt3zg= X-Google-Smtp-Source: ABdhPJy9xYff9LIPIsDObGt8ERWBvTi6YfmYoCnJqKilM2cZDKSwDGQcnLftGSiW4932taWJnp+wKQ== X-Received: by 2002:a65:5c4c:: with SMTP id v12mr14283773pgr.119.1604335999411; Mon, 02 Nov 2020 08:53:19 -0800 (PST) Received: from varodek.localdomain ([223.179.149.110]) by smtp.gmail.com with ESMTPSA id t74sm4953233pfc.47.2020.11.02.08.53.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 08:53:18 -0800 (PST) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , Bjorn Helgaas , Vaibhav Gupta , Adam Radford , "James E.J. Bottomley" , "Martin K. Petersen" , Adaptec OEM Raid Solutions , Hannes Reinecke , Bradley Grove , John Garry , Don Brace , Xiang Chen , James Smart , Dick Kennedy , Kashyap Desai , Sumit Saxena , Shivasharan S , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , Jack Wang , Balsundar P Cc: Vaibhav Gupta , Shuah Khan , linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-scsi@vger.kernel.org, esc.storagedev@microsemi.com, megaraidlinux.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH v4 15/29] scsi: mpt3sas_scsih: Drop PCI Wakeup calls from .resume Date: Mon, 2 Nov 2020 22:17:16 +0530 Message-Id: <20201102164730.324035-16-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102164730.324035-1-vaibhavgupta40@gmail.com> References: <20201102164730.324035-1-vaibhavgupta40@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The driver calls pci_enable_wake(...., false) in scsih_resume(), and there is no corresponding pci_enable_wake(...., true) in scsih_suspend(). Either it should do enable-wake the device in .suspend() or should not invoke pci_enable_wake() at all. Concluding that this driver doesn't support enable-wake and PCI core calls pci_enable_wake(pci_dev, PCI_D0, false) during resume, drop it from scsih_resume(). Signed-off-by: Vaibhav Gupta --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 5f845d7094fc..2d201558b8fb 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -11140,7 +11140,6 @@ scsih_resume(struct pci_dev *pdev) pdev, pci_name(pdev), device_state); pci_set_power_state(pdev, PCI_D0); - pci_enable_wake(pdev, PCI_D0, 0); pci_restore_state(pdev); ioc->pdev = pdev; r = mpt3sas_base_map_resources(ioc); From patchwork Mon Nov 2 16:47:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Gupta X-Patchwork-Id: 315389 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A5D2C55179 for ; Mon, 2 Nov 2020 16:53:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D3BAA22268 for ; Mon, 2 Nov 2020 16:53:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="k39IdQvP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727279AbgKBQxn (ORCPT ); Mon, 2 Nov 2020 11:53:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726860AbgKBQxm (ORCPT ); Mon, 2 Nov 2020 11:53:42 -0500 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C57D8C0617A6; Mon, 2 Nov 2020 08:53:41 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id z24so11300702pgk.3; Mon, 02 Nov 2020 08:53:41 -0800 (PST) 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=Cb4ySFnlLhJ+JhmjzTriCdxevKzKPzQ3J+4RmScEJzI=; b=k39IdQvP1VxpzbrTjqwHF03rdVaMGcVa2DaAthYQylkXsudCrqFgaVQbrIkBPu/FNd QgQXKMyda64eqPigNDlcm9mGheOisop4qdbgVCJzw/ubGzQlkcqdWK3Ar8yut9n/KnyQ SAnY1Kh1+u+17/F6wFRuhDjO/O6qf3hPw0T/D/zKjUT0WpkTMqVkzB11aE+sX2AfqC17 YTgY8W09DxEpecirzY99zQk2JIxo+vtDeGk7LqtBvr9sFweFACof13OVigrSUDEJcDz6 7GOJBI8ll20grnDg10A5kSpOhmxPsTrbhoicpFhGMjh3GPD5QiPt5+o6hQln2PxKRop2 5DnA== 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=Cb4ySFnlLhJ+JhmjzTriCdxevKzKPzQ3J+4RmScEJzI=; b=cryl0I5XaQozGAaJoSCP8wKWARe6gyb2x+qGcBJbDle0azaHG7R2YQNyh1cytUxxKj tGbY9gDG36l3qfnCqdt0n89XJl22/wXQTV96SXgxRtLnB3Iovu2/rvt8Zgh0TBmIblN0 6ev0mv6zAFXYD2OQsY/UX8lwOq8AM99/omjcZKbvTNIuq5v+Bzs3n7f7JMOlpJYJTWXi UmNG32sNphUwjxULVhaDzc07h5g5xlKUfqDmGLChqDlvrXBpuZeDbmxCvsn7TBNcuV9p PQN2we6sW87r7M8zVxJIJ727X81yct7Tm6mHpTqUdZWsRi/Erk83VNSWEOv+C92d/3sk H9Ng== X-Gm-Message-State: AOAM533eidQBhR7f7HROlErO7BVgu9fLY9z6/WrzcG0ZNBki9wUCl1Zs N0GLn35WlQrI3JwOP24tbOk= X-Google-Smtp-Source: ABdhPJyDgyx30V3H6BJoMMsQFczZcCAejBuc6H/HGyKQkmU7mR9yTb65KORXvUYyjWd/Sjka5RxOJA== X-Received: by 2002:a63:7c46:: with SMTP id l6mr8264187pgn.301.1604336021260; Mon, 02 Nov 2020 08:53:41 -0800 (PST) Received: from varodek.localdomain ([223.179.149.110]) by smtp.gmail.com with ESMTPSA id t74sm4953233pfc.47.2020.11.02.08.53.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 08:53:40 -0800 (PST) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , Bjorn Helgaas , Vaibhav Gupta , Adam Radford , "James E.J. Bottomley" , "Martin K. Petersen" , Adaptec OEM Raid Solutions , Hannes Reinecke , Bradley Grove , John Garry , Don Brace , Xiang Chen , James Smart , Dick Kennedy , Kashyap Desai , Sumit Saxena , Shivasharan S , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , Jack Wang , Balsundar P Cc: Vaibhav Gupta , Shuah Khan , linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-scsi@vger.kernel.org, esc.storagedev@microsemi.com, megaraidlinux.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH v4 17/29] scsi: lpfc: use generic power management Date: Mon, 2 Nov 2020 22:17:18 +0530 Message-Id: <20201102164730.324035-18-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102164730.324035-1-vaibhavgupta40@gmail.com> References: <20201102164730.324035-1-vaibhavgupta40@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Drivers should do only device-specific jobs. But in general, drivers using legacy PCI PM framework for .suspend()/.resume() have to manage many PCI PM-related tasks themselves which can be done by PCI Core itself. This brings extra load on the driver and it directly calls PCI helper functions to handle them. Switch to the new generic framework by updating function signatures and define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove unnecessary calls to the PCI Helper functions along with the legacy .suspend & .resume bindings. Signed-off-by: Vaibhav Gupta --- drivers/scsi/lpfc/lpfc_init.c | 100 +++++++++++----------------------- 1 file changed, 33 insertions(+), 67 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index ca25e54bb782..bf12328a5e45 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -12581,8 +12581,7 @@ lpfc_pci_remove_one_s3(struct pci_dev *pdev) /** * lpfc_pci_suspend_one_s3 - PCI func to suspend SLI-3 device for power mgmnt - * @pdev: pointer to PCI device - * @msg: power management message + * @dev_d: pointer to device * * This routine is to be called from the kernel's PCI subsystem to support * system Power Management (PM) to device with SLI-3 interface spec. When @@ -12600,10 +12599,10 @@ lpfc_pci_remove_one_s3(struct pci_dev *pdev) * 0 - driver suspended the device * Error otherwise **/ -static int -lpfc_pci_suspend_one_s3(struct pci_dev *pdev, pm_message_t msg) +static int __maybe_unused +lpfc_pci_suspend_one_s3(struct device *dev_d) { - struct Scsi_Host *shost = pci_get_drvdata(pdev); + struct Scsi_Host *shost = dev_get_drvdata(dev_d); struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; lpfc_printf_log(phba, KERN_INFO, LOG_INIT, @@ -12617,16 +12616,12 @@ lpfc_pci_suspend_one_s3(struct pci_dev *pdev, pm_message_t msg) /* Disable interrupt from device */ lpfc_sli_disable_intr(phba); - /* Save device state to PCI config space */ - pci_save_state(pdev); - pci_set_power_state(pdev, PCI_D3hot); - return 0; } /** * lpfc_pci_resume_one_s3 - PCI func to resume SLI-3 device for power mgmnt - * @pdev: pointer to PCI device + * @dev_d: pointer to device * * This routine is to be called from the kernel's PCI subsystem to support * system Power Management (PM) to device with SLI-3 interface spec. When PM @@ -12643,10 +12638,10 @@ lpfc_pci_suspend_one_s3(struct pci_dev *pdev, pm_message_t msg) * 0 - driver suspended the device * Error otherwise **/ -static int -lpfc_pci_resume_one_s3(struct pci_dev *pdev) +static int __maybe_unused +lpfc_pci_resume_one_s3(struct device *dev_d) { - struct Scsi_Host *shost = pci_get_drvdata(pdev); + struct Scsi_Host *shost = dev_get_drvdata(dev_d); struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; uint32_t intr_mode; int error; @@ -12654,19 +12649,6 @@ lpfc_pci_resume_one_s3(struct pci_dev *pdev) lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "0452 PCI device Power Management resume.\n"); - /* Restore device state from PCI config space */ - pci_set_power_state(pdev, PCI_D0); - pci_restore_state(pdev); - - /* - * As the new kernel behavior of pci_restore_state() API call clears - * device saved_state flag, need to save the restored state again. - */ - pci_save_state(pdev); - - if (pdev->is_busmaster) - pci_set_master(pdev); - /* Startup the kernel thread for this host adapter. */ phba->worker_thread = kthread_run(lpfc_do_work, phba, "lpfc_worker_%d", phba->brd_no); @@ -13423,8 +13405,7 @@ lpfc_pci_remove_one_s4(struct pci_dev *pdev) /** * lpfc_pci_suspend_one_s4 - PCI func to suspend SLI-4 device for power mgmnt - * @pdev: pointer to PCI device - * @msg: power management message + * @dev_d: pointer to device * * This routine is called from the kernel's PCI subsystem to support system * Power Management (PM) to device with SLI-4 interface spec. When PM invokes @@ -13442,10 +13423,10 @@ lpfc_pci_remove_one_s4(struct pci_dev *pdev) * 0 - driver suspended the device * Error otherwise **/ -static int -lpfc_pci_suspend_one_s4(struct pci_dev *pdev, pm_message_t msg) +static int __maybe_unused +lpfc_pci_suspend_one_s4(struct device *dev_d) { - struct Scsi_Host *shost = pci_get_drvdata(pdev); + struct Scsi_Host *shost = dev_get_drvdata(dev_d); struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; lpfc_printf_log(phba, KERN_INFO, LOG_INIT, @@ -13460,16 +13441,12 @@ lpfc_pci_suspend_one_s4(struct pci_dev *pdev, pm_message_t msg) lpfc_sli4_disable_intr(phba); lpfc_sli4_queue_destroy(phba); - /* Save device state to PCI config space */ - pci_save_state(pdev); - pci_set_power_state(pdev, PCI_D3hot); - return 0; } /** * lpfc_pci_resume_one_s4 - PCI func to resume SLI-4 device for power mgmnt - * @pdev: pointer to PCI device + * @dev_d: pointer to device * * This routine is called from the kernel's PCI subsystem to support system * Power Management (PM) to device with SLI-4 interface spac. When PM invokes @@ -13486,10 +13463,10 @@ lpfc_pci_suspend_one_s4(struct pci_dev *pdev, pm_message_t msg) * 0 - driver suspended the device * Error otherwise **/ -static int -lpfc_pci_resume_one_s4(struct pci_dev *pdev) +static int __maybe_unused +lpfc_pci_resume_one_s4(struct device *dev_d) { - struct Scsi_Host *shost = pci_get_drvdata(pdev); + struct Scsi_Host *shost = dev_get_drvdata(dev_d); struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; uint32_t intr_mode; int error; @@ -13497,19 +13474,6 @@ lpfc_pci_resume_one_s4(struct pci_dev *pdev) lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "0292 PCI device Power Management resume.\n"); - /* Restore device state from PCI config space */ - pci_set_power_state(pdev, PCI_D0); - pci_restore_state(pdev); - - /* - * As the new kernel behavior of pci_restore_state() API call clears - * device saved_state flag, need to save the restored state again. - */ - pci_save_state(pdev); - - if (pdev->is_busmaster) - pci_set_master(pdev); - /* Startup the kernel thread for this host adapter. */ phba->worker_thread = kthread_run(lpfc_do_work, phba, "lpfc_worker_%d", phba->brd_no); @@ -13825,8 +13789,7 @@ lpfc_pci_remove_one(struct pci_dev *pdev) /** * lpfc_pci_suspend_one - lpfc PCI func to suspend dev for power management - * @pdev: pointer to PCI device - * @msg: power management message + * @dev: pointer to device * * This routine is to be registered to the kernel's PCI subsystem to support * system Power Management (PM). When PM invokes this method, it dispatches @@ -13837,19 +13800,19 @@ lpfc_pci_remove_one(struct pci_dev *pdev) * 0 - driver suspended the device * Error otherwise **/ -static int -lpfc_pci_suspend_one(struct pci_dev *pdev, pm_message_t msg) +static int __maybe_unused +lpfc_pci_suspend_one(struct device *dev) { - struct Scsi_Host *shost = pci_get_drvdata(pdev); + struct Scsi_Host *shost = dev_get_drvdata(dev); struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; int rc = -ENODEV; switch (phba->pci_dev_grp) { case LPFC_PCI_DEV_LP: - rc = lpfc_pci_suspend_one_s3(pdev, msg); + rc = lpfc_pci_suspend_one_s3(dev); break; case LPFC_PCI_DEV_OC: - rc = lpfc_pci_suspend_one_s4(pdev, msg); + rc = lpfc_pci_suspend_one_s4(dev); break; default: lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, @@ -13862,7 +13825,7 @@ lpfc_pci_suspend_one(struct pci_dev *pdev, pm_message_t msg) /** * lpfc_pci_resume_one - lpfc PCI func to resume dev for power management - * @pdev: pointer to PCI device + * @dev: pointer to device * * This routine is to be registered to the kernel's PCI subsystem to support * system Power Management (PM). When PM invokes this method, it dispatches @@ -13873,19 +13836,19 @@ lpfc_pci_suspend_one(struct pci_dev *pdev, pm_message_t msg) * 0 - driver suspended the device * Error otherwise **/ -static int -lpfc_pci_resume_one(struct pci_dev *pdev) +static int __maybe_unused +lpfc_pci_resume_one(struct device *dev) { - struct Scsi_Host *shost = pci_get_drvdata(pdev); + struct Scsi_Host *shost = dev_get_drvdata(dev); struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; int rc = -ENODEV; switch (phba->pci_dev_grp) { case LPFC_PCI_DEV_LP: - rc = lpfc_pci_resume_one_s3(pdev); + rc = lpfc_pci_resume_one_s3(dev); break; case LPFC_PCI_DEV_OC: - rc = lpfc_pci_resume_one_s4(pdev); + rc = lpfc_pci_resume_one_s4(dev); break; default: lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, @@ -14065,14 +14028,17 @@ static const struct pci_error_handlers lpfc_err_handler = { .resume = lpfc_io_resume, }; +static SIMPLE_DEV_PM_OPS(lpfc_pci_pm_ops_one, + lpfc_pci_suspend_one, + lpfc_pci_resume_one); + static struct pci_driver lpfc_driver = { .name = LPFC_DRIVER_NAME, .id_table = lpfc_id_table, .probe = lpfc_pci_probe_one, .remove = lpfc_pci_remove_one, .shutdown = lpfc_pci_remove_one, - .suspend = lpfc_pci_suspend_one, - .resume = lpfc_pci_resume_one, + .driver.pm = &lpfc_pci_pm_ops_one, .err_handler = &lpfc_err_handler, }; From patchwork Mon Nov 2 16:47:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Gupta X-Patchwork-Id: 315388 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91927C55178 for ; Mon, 2 Nov 2020 16:54:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4AD5922258 for ; Mon, 2 Nov 2020 16:54:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FNiyl1hX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727305AbgKBQyD (ORCPT ); Mon, 2 Nov 2020 11:54:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726619AbgKBQyD (ORCPT ); Mon, 2 Nov 2020 11:54:03 -0500 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73560C0617A6; Mon, 2 Nov 2020 08:54:03 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id w4so1059280pgg.13; Mon, 02 Nov 2020 08:54:03 -0800 (PST) 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=VhabbmrVlKfIcloXKiUycGjVLZHaLqGck6HUDFpjzd4=; b=FNiyl1hXUBQIr2AqRDMiQQrHQtakYZefo7BHUUaFEaNe3AON3Ra5wz0jv1lYLopD/J 9q8+190FFV4gQaefv/2wGEECM1DanKSBBp6LpCc5bFyiS/gJ+vAWZ2XhBgvBprgyn077 FtvPNPx+RM9xASBAwpDud3V4EfOVN+Dh/9fc+LvsrT2IGgKnHDRKA1uwwlTf8TFb4Mo7 Xe3hTU/lEOs5umAd2rcm6QQ20EQOL36vlpNKBpAt/kwzfLP8K3TFO6RzPr+MypS1qIDV vuob7yY27jvqqNGxWe15ZTzBVzQdcCPRfXzff+iC9VGLk3vk1aq6qMg6V2WoZ2bF7s5E YD/A== 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=VhabbmrVlKfIcloXKiUycGjVLZHaLqGck6HUDFpjzd4=; b=etcvYIQRsfAcgWccS/1ttbZOzfAQKrx0/PFAhM+H1BBhHlIND6ShCVwAHZcAOrR/kX P/6Ewa8JGI3B0iCf4HttrHI8CmixXcXtv9MpoSRkY/jsRYqt1JkAvKagIvciXKIzVnmq DpbrykCdNbJhOVStoB9CGB6AAzbq8LEpfIqS6DslCgzVyOdvpisT7nmQuoVlPGTTnWJ3 UA7fyM5il8BjLYmB+Gtk3ywobeKo18FkTA/kM6l3NxXVn/xeJFDtI7/rV6DWYzySpNcN 3ZkaNaC8dnzbeeUrYdT2zu6jGzObTIyqOXyRMMCDJJFH3GFauiVuTdjcDNyKBzCT69FZ FkKg== X-Gm-Message-State: AOAM5309TZOT0f/P8k13KvBt4kSmN9Juci8JmxT0uysqYy2FwmgOsrAg cGAYL4dhn0roGfDuG1L3cOU= X-Google-Smtp-Source: ABdhPJxw8lCwnUiNaQAX76vwhA4YIcPI6dIqpyLBz643suOBf7Pk6OZM1tXuc9wBPSC5zsTj+b76jA== X-Received: by 2002:a17:90a:4a15:: with SMTP id e21mr4038914pjh.130.1604336042989; Mon, 02 Nov 2020 08:54:02 -0800 (PST) Received: from varodek.localdomain ([223.179.149.110]) by smtp.gmail.com with ESMTPSA id t74sm4953233pfc.47.2020.11.02.08.53.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 08:54:02 -0800 (PST) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , Bjorn Helgaas , Vaibhav Gupta , Adam Radford , "James E.J. Bottomley" , "Martin K. Petersen" , Adaptec OEM Raid Solutions , Hannes Reinecke , Bradley Grove , John Garry , Don Brace , Xiang Chen , James Smart , Dick Kennedy , Kashyap Desai , Sumit Saxena , Shivasharan S , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , Jack Wang , Balsundar P Cc: Vaibhav Gupta , Shuah Khan , linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-scsi@vger.kernel.org, esc.storagedev@microsemi.com, megaraidlinux.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH v4 19/29] scsi: pm_8001: use generic power management Date: Mon, 2 Nov 2020 22:17:20 +0530 Message-Id: <20201102164730.324035-20-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102164730.324035-1-vaibhavgupta40@gmail.com> References: <20201102164730.324035-1-vaibhavgupta40@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Drivers should do only device-specific jobs. But in general, drivers using legacy PCI PM framework for .suspend()/.resume() have to manage many PCI PM-related tasks themselves which can be done by PCI Core itself. This brings extra load on the driver and it directly calls PCI helper functions to handle them. Switch to the new generic framework by updating function signatures and define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove unnecessary calls to the PCI Helper functions along with the legacy .suspend & .resume bindings. Signed-off-by: Vaibhav Gupta --- drivers/scsi/pm8001/pm8001_init.c | 45 +++++++++++-------------------- 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index d47ed9a33173..7a732fd09b38 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c @@ -1257,23 +1257,21 @@ static void pm8001_pci_remove(struct pci_dev *pdev) /** * pm8001_pci_suspend - power management suspend main entry point - * @pdev: PCI device struct - * @state: PM state change to (usually PCI_D3) + * @dev: Device struct * * Returns 0 success, anything else error. */ -static int pm8001_pci_suspend(struct pci_dev *pdev, pm_message_t state) +static int __maybe_unused pm8001_pci_suspend(struct device *dev) { + struct pci_dev *pdev = to_pci_dev(dev); struct sas_ha_struct *sha = pci_get_drvdata(pdev); - struct pm8001_hba_info *pm8001_ha; + struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; int i, j; - u32 device_state; - pm8001_ha = sha->lldd_ha; sas_suspend_ha(sha); flush_workqueue(pm8001_wq); scsi_block_requests(pm8001_ha->shost); if (!pdev->pm_cap) { - dev_err(&pdev->dev, " PCI PM not supported\n"); + dev_err(dev, " PCI PM not supported\n"); return -ENODEV; } PM8001_CHIP_DISP->interrupt_disable(pm8001_ha, 0xFF); @@ -1296,24 +1294,21 @@ static int pm8001_pci_suspend(struct pci_dev *pdev, pm_message_t state) for (j = 0; j < PM8001_MAX_MSIX_VEC; j++) tasklet_kill(&pm8001_ha->tasklet[j]); #endif - device_state = pci_choose_state(pdev, state); pm8001_printk("pdev=0x%p, slot=%s, entering " - "operating state [D%d]\n", pdev, - pm8001_ha->name, device_state); - pci_save_state(pdev); - pci_disable_device(pdev); - pci_set_power_state(pdev, device_state); + "suspended state\n", pdev, + pm8001_ha->name); return 0; } /** * pm8001_pci_resume - power management resume main entry point - * @pdev: PCI device struct + * @dev: Device struct * * Returns 0 success, anything else error. */ -static int pm8001_pci_resume(struct pci_dev *pdev) +static int __maybe_unused pm8001_pci_resume(struct device *dev) { + struct pci_dev *pdev = to_pci_dev(dev); struct sas_ha_struct *sha = pci_get_drvdata(pdev); struct pm8001_hba_info *pm8001_ha; int rc; @@ -1326,16 +1321,6 @@ static int pm8001_pci_resume(struct pci_dev *pdev) pm8001_printk("pdev=0x%p, slot=%s, resuming from previous " "operating state [D%d]\n", pdev, pm8001_ha->name, device_state); - pci_set_power_state(pdev, PCI_D0); - pci_restore_state(pdev); - rc = pci_enable_device(pdev); - if (rc) { - pm8001_printk("slot=%s Enable device failed during resume\n", - pm8001_ha->name); - goto err_out_enable; - } - - pci_set_master(pdev); rc = pci_go_44(pdev); if (rc) goto err_out_disable; @@ -1396,8 +1381,7 @@ static int pm8001_pci_resume(struct pci_dev *pdev) err_out_disable: scsi_remove_host(pm8001_ha->shost); - pci_disable_device(pdev); -err_out_enable: + return rc; } @@ -1480,13 +1464,16 @@ static struct pci_device_id pm8001_pci_table[] = { {} /* terminate list */ }; +static SIMPLE_DEV_PM_OPS(pm8001_pci_pm_ops, + pm8001_pci_suspend, + pm8001_pci_resume); + static struct pci_driver pm8001_pci_driver = { .name = DRV_NAME, .id_table = pm8001_pci_table, .probe = pm8001_pci_probe, .remove = pm8001_pci_remove, - .suspend = pm8001_pci_suspend, - .resume = pm8001_pci_resume, + .driver.pm = &pm8001_pci_pm_ops, }; /** From patchwork Mon Nov 2 16:47:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Gupta X-Patchwork-Id: 315387 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 344A0C388F2 for ; Mon, 2 Nov 2020 16:54:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EDA2922258 for ; Mon, 2 Nov 2020 16:54:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CggIJjuL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727343AbgKBQyY (ORCPT ); Mon, 2 Nov 2020 11:54:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726860AbgKBQyY (ORCPT ); Mon, 2 Nov 2020 11:54:24 -0500 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 1EB18C0617A6; Mon, 2 Nov 2020 08:54:24 -0800 (PST) Received: by mail-pf1-x444.google.com with SMTP id 72so4910754pfv.7; Mon, 02 Nov 2020 08:54:24 -0800 (PST) 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=tsLH0jLFmVf53d+PF9Z2Na19r4rjuIS/8Zz7+PtjCXU=; b=CggIJjuLgbNz5h9DMzIwuEZcDOyBeLnQvT5WCGynKw9pz1RuWMdXCJOWYp3NZzApN1 5TBUiKdxFqSDRUHRCO2qU3kio/t0jZwx4abi/KMvW5/UTq0nqPOsP1O4ISj+P/XIDkuH rpNVoompz/nXdUmotTvmXnXwyZasLldh77ZFlBopuN2bA8ODByuIso2frephWNPNMtVW WneU29PmIXRrtBlNSHAqfCqNigB9Itbwqg/wTL6QT7uIFrHWrp6630UHXsjJIOYgn3sq vvXQZggrNhY8c0S3Wt//xQ+geunh8dWFZlZ0BymMoJhsD/DrtE6kuxIlfI/Kc69YAQtB JAJQ== 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=tsLH0jLFmVf53d+PF9Z2Na19r4rjuIS/8Zz7+PtjCXU=; b=dbqatvVHzdQKPm5dTPWdqfRmOelvsSDRRWuL/jEqE3fPxCZRWTXVMQ2MOKnqly3EBy zVknUHl4LpL7inYKWN35A+wFPjMUXxpAX6w/sgTmB6A70/2GwpgjsZOv1DfTCCinVYTE h/J4m+7jv+SOKemWB5WWu696lSQArN+V4gfDou++xnEF8/sVCKbQgTm5PvtBACZHV1ji 66aU82GoaRQFuWBz2SfXlbGUoIAuuCE278RqSlmzBa8ppuQGZPYnujs139STHvqvS7qp p/K4cbXmC7JcTEYMAeU14V0uP2I8t7gWJcwHl9wOxgDTxRo8GBm19yfg21XNWvsRb3Lu N1hg== X-Gm-Message-State: AOAM5318hLUdYDLIOvBw3/8ca55L4LRcyUzaIq0wLd2valKwKrVp0JgM LnN4A7WO/zKKNGMMZy/cJ20= X-Google-Smtp-Source: ABdhPJxfN31gUnc7+QlY1HyEuUCBrTa6c8PhSwyeZjh6Dft+Dt5ux4oRfpn1AS4dPI5FbYSinWGC5w== X-Received: by 2002:a63:70d:: with SMTP id 13mr14407549pgh.263.1604336063665; Mon, 02 Nov 2020 08:54:23 -0800 (PST) Received: from varodek.localdomain ([223.179.149.110]) by smtp.gmail.com with ESMTPSA id t74sm4953233pfc.47.2020.11.02.08.54.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 08:54:23 -0800 (PST) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , Bjorn Helgaas , Vaibhav Gupta , Adam Radford , "James E.J. Bottomley" , "Martin K. Petersen" , Adaptec OEM Raid Solutions , Hannes Reinecke , Bradley Grove , John Garry , Don Brace , Xiang Chen , James Smart , Dick Kennedy , Kashyap Desai , Sumit Saxena , Shivasharan S , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , Jack Wang , Balsundar P Cc: Vaibhav Gupta , Shuah Khan , linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-scsi@vger.kernel.org, esc.storagedev@microsemi.com, megaraidlinux.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com, Don Brace Subject: [PATCH v4 21/29] scsi: 3w-9xxx: Drop PCI Wakeup calls from .resume Date: Mon, 2 Nov 2020 22:17:22 +0530 Message-Id: <20201102164730.324035-22-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102164730.324035-1-vaibhavgupta40@gmail.com> References: <20201102164730.324035-1-vaibhavgupta40@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The driver calls pci_enable_wake(...., false) in twa_resume(), and there is no corresponding pci_enable_wake(...., true) in twa_suspend(). Either it should do enable-wake the device in .suspend() or should not invoke pci_enable_wake() at all. Concluding that this driver doesn't support enable-wake and PCI core calls pci_enable_wake(pci_dev, PCI_D0, false) during resume, drop it from twa_resume(). Signed-off-by: Vaibhav Gupta Acked-by: Don Brace --- drivers/scsi/3w-9xxx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index 3337b1e80412..e458e99ff161 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c @@ -2230,7 +2230,6 @@ static int twa_resume(struct pci_dev *pdev) printk(KERN_WARNING "3w-9xxx: Resuming host %d.\n", tw_dev->host->host_no); pci_set_power_state(pdev, PCI_D0); - pci_enable_wake(pdev, PCI_D0, 0); pci_restore_state(pdev); retval = pci_enable_device(pdev); From patchwork Mon Nov 2 16:47:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Gupta X-Patchwork-Id: 315386 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4165BC00A89 for ; Mon, 2 Nov 2020 16:54:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DDC4822268 for ; Mon, 2 Nov 2020 16:54:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NpW31TLe" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727362AbgKBQyp (ORCPT ); Mon, 2 Nov 2020 11:54:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727172AbgKBQyo (ORCPT ); Mon, 2 Nov 2020 11:54:44 -0500 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5047C0617A6; Mon, 2 Nov 2020 08:54:44 -0800 (PST) Received: by mail-pg1-x541.google.com with SMTP id o3so11269885pgr.11; Mon, 02 Nov 2020 08:54:44 -0800 (PST) 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=6ccyY/JHq4D3PLCl7N5Le5xwodBVxQCbk5cLiaDjEFw=; b=NpW31TLetItFsb140xAKZVbCVOKP2GAN9IMwURcruykGX00RcSle7+2EuM5I36CM8o fe4KsRaDfKtHUaTt5xVXCH2kez+BLnx9rJKFhORdMLQa+sk8W1vYH6YiTDcef8q2V1nl TUb30IC4T2Nfc+uLV0DYvKeXIHBywuPzlJoPTU+U8+zHYiyGEDA04TIpppSOGFkxexbh pGh73vWQpUaRpZ0IY9BxvFO5oZ4uB7CxqpYtva2SHbT1HQ+v+o8j8g0UTb+rkEAPvUH+ uaO2mHw4WvhZwEH8bDpx50oDS1g4G4FzH6lSucG9qGv8O1Aqk+f4J93leDCgYGD3nIcm IuCQ== 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=6ccyY/JHq4D3PLCl7N5Le5xwodBVxQCbk5cLiaDjEFw=; b=qM0ug096weLn6w5GT3rTvFwJ3HGTIKjq/2t7ltyS3m1RNVdcme0O96uuz5XPCKyysZ zp9kVQwtXbkhEZ7ApyYN1A4W16ADy3nZFMaTDKHNqppl4V2T+b6apzCOj5GIpaUWOTTe Qs5wbLEES0ccaZTk295LmlWufN/yaNJ8gXx7nRKz3hhIUNhBaAvIZSA96PWKe0JX5NI/ sxmoe04PP7YfAWp30M/sAGK/mhYMR4CV9/HpmqTOtpjUF4Lr/2MZlq2BOpFh/MVJwmAZ xAhMmrWj1mpNoB4U+bQeGF3e26z8vS7qJclQXte/koXilrOOWWij4bug77f8cdjGyddX whzg== X-Gm-Message-State: AOAM531HyrtWxvHIH231+q6dIjpvY54kUHvhaK3SUKz4JcOaZs1C4ClR D21DoAIhczSTmZKVBugKLuc= X-Google-Smtp-Source: ABdhPJx/1LewIo20VjBh1CMTVa+zuJIuzuWLg4W/csDX8oOWuCb+rFAFC6LAzjvhej07R0r8NoDkqA== X-Received: by 2002:a17:90a:1188:: with SMTP id e8mr18750804pja.61.1604336084398; Mon, 02 Nov 2020 08:54:44 -0800 (PST) Received: from varodek.localdomain ([223.179.149.110]) by smtp.gmail.com with ESMTPSA id t74sm4953233pfc.47.2020.11.02.08.54.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 08:54:43 -0800 (PST) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , Bjorn Helgaas , Vaibhav Gupta , Adam Radford , "James E.J. Bottomley" , "Martin K. Petersen" , Adaptec OEM Raid Solutions , Hannes Reinecke , Bradley Grove , John Garry , Don Brace , Xiang Chen , James Smart , Dick Kennedy , Kashyap Desai , Sumit Saxena , Shivasharan S , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , Jack Wang , Balsundar P Cc: Vaibhav Gupta , Shuah Khan , linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-scsi@vger.kernel.org, esc.storagedev@microsemi.com, megaraidlinux.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH v4 23/29] scsi: 3w-sas: Drop PCI Wakeup calls from .resume Date: Mon, 2 Nov 2020 22:17:24 +0530 Message-Id: <20201102164730.324035-24-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102164730.324035-1-vaibhavgupta40@gmail.com> References: <20201102164730.324035-1-vaibhavgupta40@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The driver calls pci_enable_wake(...., false) in twl_resume(), and there is no corresponding pci_enable_wake(...., true) in twl_suspend(). Either it should do enable-wake the device in .suspend() or should not invoke pci_enable_wake() at all. Concluding that this driver doesn't support enable-wake and PCI core calls pci_enable_wake(pci_dev, PCI_D0, false) during resume, drop it from twl_resume(). Signed-off-by: Vaibhav Gupta --- drivers/scsi/3w-sas.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c index dda6fa857709..0b4888199699 100644 --- a/drivers/scsi/3w-sas.c +++ b/drivers/scsi/3w-sas.c @@ -1795,7 +1795,6 @@ static int twl_resume(struct pci_dev *pdev) printk(KERN_WARNING "3w-sas: Resuming host %d.\n", tw_dev->host->host_no); pci_set_power_state(pdev, PCI_D0); - pci_enable_wake(pdev, PCI_D0, 0); pci_restore_state(pdev); retval = pci_enable_device(pdev); From patchwork Mon Nov 2 16:47:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Gupta X-Patchwork-Id: 315385 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB91EC4742C for ; Mon, 2 Nov 2020 16:55:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 99E0822268 for ; Mon, 2 Nov 2020 16:55:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gEvgla2U" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727418AbgKBQzE (ORCPT ); Mon, 2 Nov 2020 11:55:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727324AbgKBQzD (ORCPT ); Mon, 2 Nov 2020 11:55:03 -0500 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5102C0617A6; Mon, 2 Nov 2020 08:55:03 -0800 (PST) Received: by mail-pg1-x543.google.com with SMTP id 62so4005693pgg.12; Mon, 02 Nov 2020 08:55:03 -0800 (PST) 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=2ui/Tg6A0BnaN3BBtG1fWoCuT6IRPSKhNvvy+KUOGlY=; b=gEvgla2U5+zkdxzjNq4Y+OqR7bhdhQ0U0ekzs2BUF7LP6e6f6brIFD04ZOYiDVPHxd B9oVKKMNwBQWGe66H/1aQESSOVXsP63gLokNheNZit56xFJNuEMiCdzQnrKBqRmPJJWT lDquROHkFpB84dZuD0RVTYUpGgLlebkH52pLhkaJJ2Sldm9cSK/RwmtiR05ZhyIlBEeb uuUV0QHyV2oMWiQgqSWjPhbJkWsPRJ7dqtZSAzYTrv6st0o9gasryxNlww5hQkhTMyqo zocJxNcaS/PPboDIGkm18Ko5e4bHENEqABMuZj6W15JKx131fJFy2FB8t+KrLXK0mQ64 YaYA== 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=2ui/Tg6A0BnaN3BBtG1fWoCuT6IRPSKhNvvy+KUOGlY=; b=IwECKlz9QYjqSXjlJ+xcI6DI2hl4fCmlfXqO7V5+ujSNfuSK65X39pn9qLfLr/7mT7 SdANwnvZ0fGooastfyMo+FMRaAJ1l7+Ert3n+wk/shCBaCDFEewLj32JqvWHWQ5dOtfI v1noCisM6WBONKGfSJ697zrQO1oKw+nvJnXMmi/ypcPFfEO6gwfMiATK9Z0WBa5bpdnW Ux32VKIiG2+Tgbt+lr1dEyHPsk/ZtvBta2oMulXdDf7NRxeOHTdIGjsZLU3FG0k9u6Kd EyMzbHv+mC232alI4XI0EFH24R3ytsbEA1+pJ9DBzKBDyw53vpCsNJCjLdWwHuisPYY5 XZlg== X-Gm-Message-State: AOAM5324iOEnFLVTvoVWp+PqQ5ZJFuZo2Qn2M4IRhbNptdBjNe8NN/og n1S/yYhN3NCKr35G3Tob04Q= X-Google-Smtp-Source: ABdhPJyj629fp48GcZrJ+3yMSSNljQLe94icEhcMlzF6ecfvj/MGCVMilJk+PvxHmE3Q2s0IobZPjA== X-Received: by 2002:a17:90b:994:: with SMTP id bl20mr18627123pjb.34.1604336103472; Mon, 02 Nov 2020 08:55:03 -0800 (PST) Received: from varodek.localdomain ([223.179.149.110]) by smtp.gmail.com with ESMTPSA id t74sm4953233pfc.47.2020.11.02.08.54.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 08:55:03 -0800 (PST) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , Bjorn Helgaas , Vaibhav Gupta , Adam Radford , "James E.J. Bottomley" , "Martin K. Petersen" , Adaptec OEM Raid Solutions , Hannes Reinecke , Bradley Grove , John Garry , Don Brace , Xiang Chen , James Smart , Dick Kennedy , Kashyap Desai , Sumit Saxena , Shivasharan S , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , Jack Wang , Balsundar P Cc: Vaibhav Gupta , Shuah Khan , linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-scsi@vger.kernel.org, esc.storagedev@microsemi.com, megaraidlinux.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH v4 25/29] scsi: mvumi: Drop PCI Wakeup calls from .resume Date: Mon, 2 Nov 2020 22:17:26 +0530 Message-Id: <20201102164730.324035-26-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102164730.324035-1-vaibhavgupta40@gmail.com> References: <20201102164730.324035-1-vaibhavgupta40@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The driver calls pci_enable_wake(...., false) in mvumi_resume(), and there is no corresponding pci_enable_wake(...., true) in mvumi_suspend(). Either it should do enable-wake the device in .suspend() or should not invoke pci_enable_wake() at all. Concluding that this driver doesn't support enable-wake and PCI core calls pci_enable_wake(pci_dev, PCI_D0, false) during resume, drop it from mvumi_resume(). Signed-off-by: Vaibhav Gupta --- drivers/scsi/mvumi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c index 0354898d7cac..7cd9c70e32dd 100644 --- a/drivers/scsi/mvumi.c +++ b/drivers/scsi/mvumi.c @@ -2595,7 +2595,6 @@ static int __maybe_unused mvumi_resume(struct pci_dev *pdev) mhba = pci_get_drvdata(pdev); pci_set_power_state(pdev, PCI_D0); - pci_enable_wake(pdev, PCI_D0, 0); pci_restore_state(pdev); ret = pci_enable_device(pdev); From patchwork Mon Nov 2 16:47:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Gupta X-Patchwork-Id: 315384 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27053C00A89 for ; Mon, 2 Nov 2020 16:55:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD694206F9 for ; Mon, 2 Nov 2020 16:55:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X+zOGPT/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727692AbgKBQzX (ORCPT ); Mon, 2 Nov 2020 11:55:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727688AbgKBQzX (ORCPT ); Mon, 2 Nov 2020 11:55:23 -0500 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 4AEDDC0617A6; Mon, 2 Nov 2020 08:55:23 -0800 (PST) Received: by mail-pf1-x444.google.com with SMTP id 72so4913122pfv.7; Mon, 02 Nov 2020 08:55:23 -0800 (PST) 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=EXCGiZLEfZtvWjQ4e/G4dbiDVH55KoRFUUF32V42VvE=; b=X+zOGPT/TSOjE20bmMX712PNBloY0JW3OvLlxo329Ib1Nf2+FbziCV/QGDeTkMtx3D Ab6QfTFENhrYD1E/hwYQlE6GPQRAaqwsm3H1gCYd65BpugqByfoG3PnQ4AG4MMPNdBhm 1FtG6g90mxk2rKio+tEnH6/jKTlWAcNL5g+wjjNzYlzM8idwGsSZ+iCykVZSPWTTqivi WZ352otPwDz30BsdcSrChlsHrFNfm1b/w3AHyNdbVSDJoXEa6FU9mnfJNrr295p8orMa yKxsCSYOkyY4oE/6MbL82LydkpnzJTbqmN8AwhAm1RYe8+lwWUhiSIV4r4rQUh7gT3TO pCVA== 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=EXCGiZLEfZtvWjQ4e/G4dbiDVH55KoRFUUF32V42VvE=; b=fpaKd6KpQTVQwPhyV/g68Zvfvb9M7k39T1G6xhknP3by+qdijbmPWUBm5GW3z3tdtj VIAh27MMTha3d4/VLRQ0Vw0KQDVLRe3OaA8phltfyGp1e95LqfnCOUlyGj6poPee6m/e 3nre9h6NJ8ZWBFcdzG80KZebNLrERkZC683gb4+P3mjKbOkDy/So1CnegvZGpfJnq3n6 yQdWeYNoqRUj/l7zyF2OiPngyu0CIJtAqsFo+E+z1cPr2P6wjaG/9K5cHs0RXsDcB4jb rdQJIV5Lnh7YuhKGolCS55gcLA5ysXVLNTzPOIFCm/F4VAB+ML3bdoYls/kKhqBMSQS0 y0ZA== X-Gm-Message-State: AOAM530acSaAF2TNXLQlsZ9UWFXc1QVSlwn3zCCwFm+F8bqIwa5PQSW9 0AOwcF9XscrAHl4OVSziCJ0= X-Google-Smtp-Source: ABdhPJwzfPgvdSwIBa5QtR9xO4o0HjNoNHKyv4uGH33LCWmGslB9FXZpefstEtLmcHt2vG3qPnXRHw== X-Received: by 2002:a17:90a:fb8d:: with SMTP id cp13mr7412843pjb.168.1604336122852; Mon, 02 Nov 2020 08:55:22 -0800 (PST) Received: from varodek.localdomain ([223.179.149.110]) by smtp.gmail.com with ESMTPSA id t74sm4953233pfc.47.2020.11.02.08.55.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 08:55:22 -0800 (PST) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , Bjorn Helgaas , Vaibhav Gupta , Adam Radford , "James E.J. Bottomley" , "Martin K. Petersen" , Adaptec OEM Raid Solutions , Hannes Reinecke , Bradley Grove , John Garry , Don Brace , Xiang Chen , James Smart , Dick Kennedy , Kashyap Desai , Sumit Saxena , Shivasharan S , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , Jack Wang , Balsundar P Cc: Vaibhav Gupta , Shuah Khan , linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-scsi@vger.kernel.org, esc.storagedev@microsemi.com, megaraidlinux.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH v4 27/29] scsi: mvumi: update function description Date: Mon, 2 Nov 2020 22:17:28 +0530 Message-Id: <20201102164730.324035-28-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102164730.324035-1-vaibhavgupta40@gmail.com> References: <20201102164730.324035-1-vaibhavgupta40@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org There is no "device" parameter in mvumi_shutdown(). Instead there is "pdev" which is not described. Signed-off-by: Vaibhav Gupta --- drivers/scsi/mvumi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c index bbf0faac1f05..6c82b0bc391a 100644 --- a/drivers/scsi/mvumi.c +++ b/drivers/scsi/mvumi.c @@ -2559,7 +2559,7 @@ static void mvumi_detach_one(struct pci_dev *pdev) /** * mvumi_shutdown - Shutdown entry point - * @device: Generic device structure + * @pdev: PCI device structure */ static void mvumi_shutdown(struct pci_dev *pdev) { From patchwork Mon Nov 2 16:47:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Gupta X-Patchwork-Id: 315383 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90DC1C388F2 for ; Mon, 2 Nov 2020 16:55:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3EDB322277 for ; Mon, 2 Nov 2020 16:55:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DSlnE7WO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727387AbgKBQzo (ORCPT ); Mon, 2 Nov 2020 11:55:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727151AbgKBQzo (ORCPT ); Mon, 2 Nov 2020 11:55:44 -0500 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDF14C0617A6; Mon, 2 Nov 2020 08:55:43 -0800 (PST) Received: by mail-pf1-x443.google.com with SMTP id 133so11606802pfx.11; Mon, 02 Nov 2020 08:55:43 -0800 (PST) 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=1YdlygNrEXUlcZfght3UiooWvJCdKrIM8fi0Iud6y9Y=; b=DSlnE7WOf8he6FwOZCHT0o0XLzJMz58pzJ8F8DkrkD5UT5XNdt4xRz8jQ+ehq9l8Np wIw+a9CV1/PHPbvYYAtenesSaPDQ6MbHpwtdOv89La0LK+/mL0g0NLcCo7HmahFBnp6G 9hLADmmoaDc4d40gKXJbNmthS2Cnl1TrjysQVV+TfK9fy12cnhMJd+g/DcAiCwphLpRD OwODZPwdwRvHZHTqVc+0SZt50nyKFXzDL/uy5vCNJtZFDLUjTTn2sTiGNqOLK6woOdNx 4uEj0KnUBhRMVdwRQR04iYpkHu3sBiuVuRLAnDTvrY6MoGdNG8/88lEG3MSVbfkDufGg eNug== 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=1YdlygNrEXUlcZfght3UiooWvJCdKrIM8fi0Iud6y9Y=; b=G68NmBk9R184yf4xrkyvNgZhwCgckYNexns3uhKVdxQmMeDGwi0RP4CI4dlifXvaKB PPu3jJasUfwkpEoiKp/FD/Fpv449vZLW+wRtRpXKPAjWu74mOW4GKOjjirMMAYukNeg4 3KpADnr6b6DYsjFJNlBim2X9KhkblEcBSFVkHcSkjXfsVEU1KJOAVlAb9yt/YeBNlr6q Q2XK1fmjnqIJHRYaVcaEgguxDfw4QjQrlYyPup2oyCsOiPAUtrReWMfJZl5u1lcjTh+q WErCZPSXB4R9t0CDeaW9B/CEuyhUxRXbSvg6AvZPYTSz6Kx4BPGjOtuxoAmy8OAGe83G jH2g== X-Gm-Message-State: AOAM532DlfPNvBwJHUPgqaYvXMBPzJVixPywfSOXYY3pLFsKKVH15Q18 Sr5vQNphTzp6cAASngK5Rk0= X-Google-Smtp-Source: ABdhPJyKCCtMCVaSvU3Is+RZvy6q7HpSGUGMl4yzO6ssLEtChPuyUb5A8lINnWDTzVhEeOe929D7+Q== X-Received: by 2002:a63:1c45:: with SMTP id c5mr10089758pgm.357.1604336143430; Mon, 02 Nov 2020 08:55:43 -0800 (PST) Received: from varodek.localdomain ([223.179.149.110]) by smtp.gmail.com with ESMTPSA id t74sm4953233pfc.47.2020.11.02.08.55.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 08:55:42 -0800 (PST) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , Bjorn Helgaas , Vaibhav Gupta , Adam Radford , "James E.J. Bottomley" , "Martin K. Petersen" , Adaptec OEM Raid Solutions , Hannes Reinecke , Bradley Grove , John Garry , Don Brace , Xiang Chen , James Smart , Dick Kennedy , Kashyap Desai , Sumit Saxena , Shivasharan S , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , Jack Wang , Balsundar P Cc: Vaibhav Gupta , Shuah Khan , linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-scsi@vger.kernel.org, esc.storagedev@microsemi.com, megaraidlinux.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH v4 29/29] scsi: pmcraid: use generic power management Date: Mon, 2 Nov 2020 22:17:30 +0530 Message-Id: <20201102164730.324035-30-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102164730.324035-1-vaibhavgupta40@gmail.com> References: <20201102164730.324035-1-vaibhavgupta40@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Drivers should do only device-specific jobs. But in general, drivers using legacy PCI PM framework for .suspend()/.resume() have to manage many PCI PM-related tasks themselves which can be done by PCI Core itself. This brings extra load on the driver and it directly calls PCI helper functions to handle them. Switch to the new generic framework by updating function signatures and define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove unnecessary calls to the PCI Helper functions along with the legacy .suspend & .resume bindings. Signed-off-by: Vaibhav Gupta --- drivers/scsi/pmcraid.c | 43 ++++++++++-------------------------------- 1 file changed, 10 insertions(+), 33 deletions(-) diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index 5c767cd8ffc3..834556ea21d2 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c @@ -5234,53 +5234,37 @@ static void pmcraid_remove(struct pci_dev *pdev) return; } -#ifdef CONFIG_PM /** * pmcraid_suspend - driver suspend entry point for power management - * @pdev: PCI device structure - * @state: PCI power state to suspend routine + * @dev: Device structure * * Return Value - 0 always */ -static int pmcraid_suspend(struct pci_dev *pdev, pm_message_t state) +static int __maybe_unused pmcraid_suspend(struct device *dev) { + struct pci_dev *pdev = to_pci_dev(dev); struct pmcraid_instance *pinstance = pci_get_drvdata(pdev); pmcraid_shutdown(pdev); pmcraid_disable_interrupts(pinstance, ~0); pmcraid_kill_tasklets(pinstance); - pci_set_drvdata(pinstance->pdev, pinstance); pmcraid_unregister_interrupt_handler(pinstance); - pci_save_state(pdev); - pci_disable_device(pdev); - pci_set_power_state(pdev, pci_choose_state(pdev, state)); return 0; } /** * pmcraid_resume - driver resume entry point PCI power management - * @pdev: PCI device structure + * @dev: Device structure * * Return Value - 0 in case of success. Error code in case of any failure */ -static int pmcraid_resume(struct pci_dev *pdev) +static int __maybe_unused pmcraid_resume(struct device *dev) { + struct pci_dev *pdev = to_pci_dev(dev); struct pmcraid_instance *pinstance = pci_get_drvdata(pdev); struct Scsi_Host *host = pinstance->host; - int rc; - - pci_set_power_state(pdev, PCI_D0); - pci_restore_state(pdev); - - rc = pci_enable_device(pdev); - - if (rc) { - dev_err(&pdev->dev, "resume: Enable device failed\n"); - return rc; - } - - pci_set_master(pdev); + int rc = 0; if (sizeof(dma_addr_t) == 4 || dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) @@ -5333,18 +5317,10 @@ static int pmcraid_resume(struct pci_dev *pdev) scsi_host_put(host); disable_device: - pci_disable_device(pdev); return rc; } -#else - -#define pmcraid_suspend NULL -#define pmcraid_resume NULL - -#endif /* CONFIG_PM */ - /** * pmcraid_complete_ioa_reset - Called by either timer or tasklet during * completion of the ioa reset @@ -5832,6 +5808,8 @@ static int pmcraid_probe(struct pci_dev *pdev, return -ENODEV; } +static SIMPLE_DEV_PM_OPS(pmcraid_pm_ops, pmcraid_suspend, pmcraid_resume); + /* * PCI driver structure of pmcraid driver */ @@ -5840,8 +5818,7 @@ static struct pci_driver pmcraid_driver = { .id_table = pmcraid_pci_table, .probe = pmcraid_probe, .remove = pmcraid_remove, - .suspend = pmcraid_suspend, - .resume = pmcraid_resume, + .driver.pm = &pmcraid_pm_ops, .shutdown = pmcraid_shutdown };