[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190724122235.21639-1-hslester96@gmail.com>
Date: Wed, 24 Jul 2019 20:22:35 +0800
From: Chuhong Yuan <hslester96@...il.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Keith Busch <kbusch@...nel.org>, Jens Axboe <axboe@...com>,
Christoph Hellwig <hch@....de>,
Sagi Grimberg <sagi@...mberg.me>,
linux-nvme@...ts.infradead.org, linux-kernel@...r.kernel.org,
Chuhong Yuan <hslester96@...il.com>
Subject: [PATCH] nvme-pci: Use dev_get_drvdata where possible
Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.
Signed-off-by: Chuhong Yuan <hslester96@...il.com>
---
drivers/nvme/host/pci.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index bb970ca82517..3c6411f4d590 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2845,7 +2845,7 @@ static int nvme_set_power_state(struct nvme_ctrl *ctrl, u32 ps)
static int nvme_resume(struct device *dev)
{
- struct nvme_dev *ndev = pci_get_drvdata(to_pci_dev(dev));
+ struct nvme_dev *ndev = dev_get_drvdata(dev);
struct nvme_ctrl *ctrl = &ndev->ctrl;
if (pm_resume_via_firmware() || !ctrl->npss ||
@@ -2914,7 +2914,7 @@ static int nvme_suspend(struct device *dev)
static int nvme_simple_suspend(struct device *dev)
{
- struct nvme_dev *ndev = pci_get_drvdata(to_pci_dev(dev));
+ struct nvme_dev *ndev = dev_get_drvdata(dev);
nvme_dev_disable(ndev, true);
return 0;
@@ -2922,8 +2922,7 @@ static int nvme_simple_suspend(struct device *dev)
static int nvme_simple_resume(struct device *dev)
{
- struct pci_dev *pdev = to_pci_dev(dev);
- struct nvme_dev *ndev = pci_get_drvdata(pdev);
+ struct nvme_dev *ndev = dev_get_drvdata(dev);
nvme_reset_ctrl(&ndev->ctrl);
return 0;
--
2.20.1
Powered by blists - more mailing lists