Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp3440092pxx; Mon, 2 Nov 2020 08:57:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJx7q0/TYW9xDLyJLGKXc876kiw+ab8RzriOtZc6C0bgjsn+CXpC+s4ckdFa+M3V6OBU3iRg X-Received: by 2002:a17:906:7c4a:: with SMTP id g10mr12052173ejp.545.1604336270858; Mon, 02 Nov 2020 08:57:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604336270; cv=none; d=google.com; s=arc-20160816; b=hFpnIl+AIJchaiyn/uWhvKXI++w1fApEQVcWtmcU6BLFbg2/Cm54DHz7kgb0EkYIb6 txBpKxbMll5hCS2ziBssTXN5sjjovtUfZJ61JjXvjAuqw/8+YhO7qXDgPorMmU58Xsw+ kK6pwH/fPltd7WeTD6oDJP5I+8FJBnc+w89wpdoescItJJaWwDekDGuNVEwRwf/yIoD/ UVnnJ3E8QwoBaNEvTOHgzMAsFv6goE1C09PqcG//A1tkdFGD88sWVn+oSppZkga/+sdI kA6ECS9s8IY1sG8Dyf8pDrTt28uijRPQiGDQOpZChR5lWwsukv4nhGrqa1eqQzEhK36O rm4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=y9mWg+/4v2UCFJAlCKvgYuV+7m/IMMSCBwMkcMZiS84=; b=DPV2iGuA831unc1t4YpDINYkfT2lbZFKpQZEBgdQItIoP56qA/lAoearxp2hYVddZG yPI3sTh9inPcB3pOFRDXNmzyDX55xJmp/dVgQSloz6xS/ofzh42CdR2HDRlnnEaRP/4N z0mBgdmnGUhr3F/G45ZismiMCtknPiycMtz9IcQFlhjW2yymWj0fVUVxM0r44RJc8VB/ n71L93QQLOiXIgeMDjtMNmFmYxPa7T2h+qmZNSJvInFoPOywnKyVDiX/1SRmxrw92ehJ DdbSE4UBuqLowYoR9fbxeynbTFgvL1o6XiSDymwQLV1ruOAvJAIJqYwxHaR6ElUXwUR5 l1qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CGndiWGb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j7si10658805edy.250.2020.11.02.08.57.27; Mon, 02 Nov 2020 08:57:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CGndiWGb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727623AbgKBQyO (ORCPT + 99 others); Mon, 2 Nov 2020 11:54:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727157AbgKBQyN (ORCPT ); Mon, 2 Nov 2020 11:54:13 -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 7CB36C0617A6; Mon, 2 Nov 2020 08:54:13 -0800 (PST) Received: by mail-pg1-x543.google.com with SMTP id x13so11275252pgp.7; Mon, 02 Nov 2020 08:54:13 -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=y9mWg+/4v2UCFJAlCKvgYuV+7m/IMMSCBwMkcMZiS84=; b=CGndiWGbeSa0mZUzNP66q0m9jiwhXlWICOiDvD/aXAaAJaV11Abd15VLtUvUSiB8Oj 7HbbO6v9eHhFuHCvGlbf7bKUBw8vMz1pct/80te2IDeQGdEEsZQKEdjRiCPqGa3A/jhb kxZStACpdV/f42s2hwn5yaSZ+B5YqtZQvCHktHJOzl5DI/8opJgVkeGZWlpXVBQmjuCj HwP1zLtTDbxrTyxo40PGgdgjtU0mylXAqS9dDbhPmynAscuBSdw4yZynqaoLNJEVH72m I6zx+2RpSG9MuYE1HAWlMp6lGsKIzWx4MkEriuyMomTbCi61P6XXeZdoyUZjoZ8KpxOr sWgg== 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=y9mWg+/4v2UCFJAlCKvgYuV+7m/IMMSCBwMkcMZiS84=; b=LM/9AY5CWfS5iCxVRFc2rK65O/xtU+BDyTsJK8Kg8NtwIy2ZF6zcFNOw/kYQA+HrbS vGbpYQlMxu1QXIh0NZeAIo+yGu/2+IUAHsyslA90RgC5P72J4qK4HD7G7450Yn4HCnLd nsUcKSz/yRIcgZGq6XqTnT+m0zJhfHg1hYOAJj6yavQ3chrleXpUfClhmAGZBYg5M/vP co7qLfelNaEFlWY9GlWSJ9qdi0naXh2/2/ZMb3QeaCtPIh6njpxg1VLRT02KXWky6Ala wtOfh/+pPt8gH6d6sywI+BaDqFIPmPsS/jJ0tIVQSfHTRyH+7TO9Op4Sjo4O2Lfz6h8R gDKA== X-Gm-Message-State: AOAM531royx4XnsWRY51q9Mdu9s6vlBoYkbDj/xV1fqOnork4vbovvDP RuqgNXWjJ/aioVFqWumXhv8= X-Received: by 2002:a17:90b:994:: with SMTP id bl20mr18624263pjb.34.1604336053051; Mon, 02 Nov 2020 08:54:13 -0800 (PST) Received: from varodek.localdomain ([223.179.149.110]) by smtp.gmail.com with ESMTPSA id t74sm4953233pfc.47.2020.11.02.08.54.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 08:54:12 -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 20/29] scsi: hpsa: use generic power management Date: Mon, 2 Nov 2020 22:17:21 +0530 Message-Id: <20201102164730.324035-21-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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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/hpsa.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 83ce4f11a589..e53364141fa3 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -9090,25 +9090,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 -- 2.28.0