Skip to contentSkip to conversation

habanalabs: Use dev_get_drvdata

PATCH In review Chuhong Yuan 2 participants 2 messages Jul 23, 2019 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 habanalabs: Use dev_get_drvdata

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

---
Changes in v2:
- Split v1 into different subsystems

 drivers/misc/habanalabs/habanalabs_drv.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/misc/habanalabs/habanalabs_drv.c +2 -4
index 6f6dbe93f1df..678f61646ca9 100644
@@ -295,8 +295,7 @@ void destroy_hdev(struct hl_device *hdev)
 
 static int hl_pmops_suspend(struct device *dev)
 {
-	struct pci_dev *pdev = to_pci_dev(dev);
-	struct hl_device *hdev = pci_get_drvdata(pdev);
+	struct hl_device *hdev = dev_get_drvdata(dev);
 
 	pr_debug("Going to suspend PCI device\n");
 
@@ -310,8 +309,7 @@ static int hl_pmops_suspend(struct device *dev)
 
 static int hl_pmops_resume(struct device *dev)
 {
-	struct pci_dev *pdev = to_pci_dev(dev);
-	struct hl_device *hdev = pci_get_drvdata(pdev);
+	struct hl_device *hdev = dev_get_drvdata(dev);
 
 	pr_debug("Going to resume PCI device\n");
 
Signature · 1 line
2.20.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 37 lines · Chuhong Yuan

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

---
Changes in v2:
- Split v1 into different subsystems

 drivers/misc/habanalabs/habanalabs_drv.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/misc/habanalabs/habanalabs_drv.c +2 -5
index 6f6dbe93f1df..678f61646ca9 100644
@@ -295,8 +295,7 @@ void destroy_hdev(struct hl_device *hdev)
 
 static int hl_pmops_suspend(struct device *dev)
 {
-       struct pci_dev *pdev = to_pci_dev(dev);
-       struct hl_device *hdev = pci_get_drvdata(pdev);
+       struct hl_device *hdev = dev_get_drvdata(dev);
 
        pr_debug("Going to suspend PCI device\n");
 
@@ -310,8 +309,7 @@ static int hl_pmops_suspend(struct device *dev)
 
 static int hl_pmops_resume(struct device *dev)
 {
-       struct pci_dev *pdev = to_pci_dev(dev);
-       struct hl_device *hdev = pci_get_drvdata(pdev);
+       struct hl_device *hdev = dev_get_drvdata(dev);
 
        pr_debug("Going to resume PCI device\n");
 
--
Quoted 2 lines

2.20.1

This patch is:

And pushed to -next

Thanks,
Oded