linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers: ata: Use dev_get_drvdata where possible
@ 2019-07-23  8:06 Chuhong Yuan
  0 siblings, 0 replies; only message in thread
From: Chuhong Yuan @ 2019-07-23  8:06 UTC (permalink / raw)
  Cc: Jens Axboe, linux-ide, linux-kernel, Chuhong Yuan

Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
 drivers/ata/ahci.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index f7652baa6337..58a981cdc83f 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -836,8 +836,7 @@ static void ahci_pci_disable_interrupts(struct ata_host *host)
 
 static int ahci_pci_device_runtime_suspend(struct device *dev)
 {
-	struct pci_dev *pdev = to_pci_dev(dev);
-	struct ata_host *host = pci_get_drvdata(pdev);
+	struct ata_host *host = dev_get_drvdata(dev);
 
 	ahci_pci_disable_interrupts(host);
 	return 0;
@@ -845,8 +844,7 @@ static int ahci_pci_device_runtime_suspend(struct device *dev)
 
 static int ahci_pci_device_runtime_resume(struct device *dev)
 {
-	struct pci_dev *pdev = to_pci_dev(dev);
-	struct ata_host *host = pci_get_drvdata(pdev);
+	struct ata_host *host = dev_get_drvdata(dev);
 	int rc;
 
 	rc = ahci_pci_reset_controller(host);
@@ -859,12 +857,11 @@ static int ahci_pci_device_runtime_resume(struct device *dev)
 #ifdef CONFIG_PM_SLEEP
 static int ahci_pci_device_suspend(struct device *dev)
 {
-	struct pci_dev *pdev = to_pci_dev(dev);
-	struct ata_host *host = pci_get_drvdata(pdev);
+	struct ata_host *host = dev_get_drvdata(dev);
 	struct ahci_host_priv *hpriv = host->private_data;
 
 	if (hpriv->flags & AHCI_HFLAG_NO_SUSPEND) {
-		dev_err(&pdev->dev,
+		dev_err(dev,
 			"BIOS update required for suspend/resume\n");
 		return -EIO;
 	}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-07-23  8:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-23  8:06 [PATCH] drivers: ata: Use dev_get_drvdata where possible Chuhong Yuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).