mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peng Wu <wupeng58@huawei.com>
To: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<hkallweit1@gmail.com>, <bhelgaas@google.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<liwei391@huawei.com>, <wupeng58@huawei.com>
Subject: [PATCH] sfc/siena: fix driver suspend/resume methods
Date: Tue, 17 May 2022 01:23:34 +0000	[thread overview]
Message-ID: <20220517012334.122677-1-wupeng58@huawei.com> (raw)

Fix the missing pci_disable_device() before return
from efx_pm_resume() in the error handling case.

Meanwhile, drivers should do this:
.resume()
	pci_enable_device()
.suspend()
	pci_disable_device()

Signed-off-by: Peng Wu <wupeng58@huawei.com>
---
 drivers/net/ethernet/sfc/siena/efx.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/sfc/siena/efx.c b/drivers/net/ethernet/sfc/siena/efx.c
index 63d999e63960..4c0ab91914f2 100644
--- a/drivers/net/ethernet/sfc/siena/efx.c
+++ b/drivers/net/ethernet/sfc/siena/efx.c
@@ -1216,21 +1216,26 @@ static int efx_pm_resume(struct device *dev)
 	pci_set_master(efx->pci_dev);
 	rc = efx->type->reset(efx, RESET_TYPE_ALL);
 	if (rc)
-		return rc;
+		goto out;
 	down_write(&efx->filter_sem);
 	rc = efx->type->init(efx);
 	up_write(&efx->filter_sem);
 	if (rc)
-		return rc;
+		goto out;
 	rc = efx_pm_thaw(dev);
 	return rc;
+out:
+	pci_disable_device(pci_dev);
+	return rc;
 }
 
 static int efx_pm_suspend(struct device *dev)
 {
+	struct pci_dev *pci_dev = to_pci_dev(dev);
 	int rc;
 
 	efx_pm_freeze(dev);
+	pci_disable_device(pci_dev);
 	rc = efx_pm_poweroff(dev);
 	if (rc)
 		efx_pm_resume(dev);
-- 
2.17.1


             reply	other threads:[~2022-05-17  1:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17  1:23 Peng Wu [this message]
2022-05-18  0:55 ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220517012334.122677-1-wupeng58@huawei.com \
    --to=wupeng58@huawei.com \
    --cc=bhelgaas@google.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liwei391@huawei.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®