From patchwork Thu Oct 1 12:25: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: 287277 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.8 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 E1A73C4727F for ; Thu, 1 Oct 2020 12:31:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD6EA21D46 for ; Thu, 1 Oct 2020 12:31:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eKbTvNn2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732162AbgJAMbM (ORCPT ); Thu, 1 Oct 2020 08:31:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731987AbgJAMbL (ORCPT ); Thu, 1 Oct 2020 08:31:11 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B0A4C0613D0; Thu, 1 Oct 2020 05:31:10 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id b17so1800590pji.1; Thu, 01 Oct 2020 05:31:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=X9+5w7ntCnYJb2A+Fo6HNLMhcm7EurVWX4dh2Zlyo8c=; b=eKbTvNn2EBH7D8mRmzUMR5hFm0LyThX2Lv4WvawuKjmGiAJlFLGfpH+F59V0TqZ0i+ vLgEsgmDnPcYM/xpDRF+jiDKOg74ffpT39BkHUNeR3IjcprQZVQtoIhFABpYClJM/uX6 ADA4iVqzV9NwYTYNy0hxnGwDOysdzuKHkOOducpacFu8POHMKXVCzUqkOAsqPQN3yl/k tYxc9UXc6T0ymUDrwFvo7bTNgntDI5l6BZByVSTOcIEO3lLdVTb8SVdT8VlJqtDtqtby QOwYRD9+zzsbmTOIrjlnYyRsWdpDUb0BqqNM2BU3FCvIZ0AO6pMxNtefm/5nLt8BzZf3 NYXg== 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=X9+5w7ntCnYJb2A+Fo6HNLMhcm7EurVWX4dh2Zlyo8c=; b=XTb8K+P7yM5Y8FJhdOpYv0OjtyQ77zO0OUEA3aIKO2ncJ8BkRcaENmKgZjoT2PdNkS MLW2weiHT9sPpsfhkpRQqyiAs+Lh5li61g6a2D+lCahkFkLMiDdRTOxN7rFrkbIeiEe2 MBwXauq/DQoHzGuRM3P7pvAN2zAgkNEq6r7wrcPxb1q8U3BTv6gxVJvbdio7LJk0UnWK 6vEeN3JEp4YWCJ0s3Kl9SQBcJjxQJsPScDJ8PCDWW+NOjjxtIJULKhIQ6d3Ax5IfZcUv CGg3zlRKCQq9s8li/muE+zXuzm455KJMZ04tTQ/LOIZgQleHWa+pIkun8U20iocvDYuX VaBw== X-Gm-Message-State: AOAM530DjqVpRkqlSLauuujeV8lJ4GQ5FyW7vVGxFMThCYdD34ob93G+ AD0qEtwLHZop2rFVAZo/b3s= X-Google-Smtp-Source: ABdhPJyXECPCwBVqenedBV4SZWlPcKO0pUxmQEMyMGfbvbsvAEvzmje4h2iHqQQ96D1U3iCuvNPp2A== X-Received: by 2002:a17:90b:1b03:: with SMTP id nu3mr6910088pjb.148.1601555469972; Thu, 01 Oct 2020 05:31:09 -0700 (PDT) Received: from varodek.localdomain ([171.61.143.130]) by smtp.gmail.com with ESMTPSA id m13sm5695199pjl.45.2020.10.01.05.31.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 05:31:09 -0700 (PDT) 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 , James Smart , Dick Kennedy , Kashyap Desai , Sumit Saxena , Shivasharan S , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , Jack Wang 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 v3 19/28] scsi: hpsa: use generic power management Date: Thu, 1 Oct 2020 17:55:02 +0530 Message-Id: <20201001122511.1075420-20-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201001122511.1075420-1-vaibhavgupta40@gmail.com> References: <20201001122511.1075420-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 Signed-off-by: Vaibhav Gupta Acked-by: Don Brace --- drivers/scsi/hpsa.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 81d0414e2117..70bdd6fe91ee 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -9070,25 +9070,27 @@ static void hpsa_remove_one(struct pci_dev *pdev) hpda_free_ctlr_info(h); /* init_one 1 */ } -static int hpsa_suspend(__attribute__((unused)) struct pci_dev *pdev, - __attribute__((unused)) pm_message_t state) +static int __maybe_unused hpsa_suspend( + __attribute__((unused)) struct device *dev) { return -ENOSYS; } -static int hpsa_resume(__attribute__((unused)) struct pci_dev *pdev) +static int __maybe_unused hpsa_resume + (__attribute__((unused)) struct device *dev) { return -ENOSYS; } +static SIMPLE_DEV_PM_OPS(hpsa_pm_ops, hpsa_suspend, hpsa_resume); + static struct pci_driver hpsa_pci_driver = { .name = HPSA, .probe = hpsa_init_one, .remove = hpsa_remove_one, .id_table = hpsa_pci_device_id, /* id_table */ .shutdown = hpsa_shutdown, - .suspend = hpsa_suspend, - .resume = hpsa_resume, + .driver.pm = &hpsa_pm_ops, }; /* Fill in bucket_map[], given nsgs (the max number of