Skip to contentSkip to conversation

platform/x86: ISST: Use dev_get_drvdata

PATCH In review Chuhong Yuan 2 participants 2 messages Jul 24, 2019 – Jul 25, 2019 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: ISST: Use dev_get_drvdata

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

---
 drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c +2 -6
index f7266a115a08..ad8c7c0df4d9 100644
@@ -132,11 +132,9 @@ static void isst_if_remove(struct pci_dev *pdev)
 
 static int __maybe_unused isst_if_suspend(struct device *device)
 {
-	struct pci_dev *pdev = to_pci_dev(device);
-	struct isst_if_device *punit_dev;
+	struct isst_if_device *punit_dev = dev_get_drvdata(device);
 	int i;
 
-	punit_dev = pci_get_drvdata(pdev);
 	for (i = 0; i < ARRAY_SIZE(punit_dev->range_0); ++i)
 		punit_dev->range_0[i] = readl(punit_dev->punit_mmio +
 						mmio_range[0].beg + 4 * i);
@@ -149,11 +147,9 @@ static int __maybe_unused isst_if_suspend(struct device *device)
 
 static int __maybe_unused isst_if_resume(struct device *device)
 {
-	struct pci_dev *pdev = to_pci_dev(device);
-	struct isst_if_device *punit_dev;
+	struct isst_if_device *punit_dev = dev_get_drvdata(device);
 	int i;
 
-	punit_dev = pci_get_drvdata(pdev);
 	for (i = 0; i < ARRAY_SIZE(punit_dev->range_0); ++i)
 		writel(punit_dev->range_0[i], punit_dev->punit_mmio +
 						mmio_range[0].beg + 4 * i);
Signature · 1 line
2.20.1
#1 lore raw
Quoted 4 lines · Chuhong Yuan

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

Pushed to my review and testing queue, thanks!

Quoted 38 lines
---
 drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c +2 -7
index f7266a115a08..ad8c7c0df4d9 100644
@@ -132,11 +132,9 @@ static void isst_if_remove(struct pci_dev *pdev)
 
 static int __maybe_unused isst_if_suspend(struct device *device)
 {
-       struct pci_dev *pdev = to_pci_dev(device);
-       struct isst_if_device *punit_dev;
+       struct isst_if_device *punit_dev = dev_get_drvdata(device);
        int i;
 
-       punit_dev = pci_get_drvdata(pdev);
        for (i = 0; i < ARRAY_SIZE(punit_dev->range_0); ++i)
                punit_dev->range_0[i] = readl(punit_dev->punit_mmio +
                                                mmio_range[0].beg + 4 * i);
@@ -149,11 +147,9 @@ static int __maybe_unused isst_if_suspend(struct device *device)
 
 static int __maybe_unused isst_if_resume(struct device *device)
 {
-       struct pci_dev *pdev = to_pci_dev(device);
-       struct isst_if_device *punit_dev;
+       struct isst_if_device *punit_dev = dev_get_drvdata(device);
        int i;
 
-       punit_dev = pci_get_drvdata(pdev);
        for (i = 0; i < ARRAY_SIZE(punit_dev->range_0); ++i)
                writel(punit_dev->range_0[i], punit_dev->punit_mmio +
                                                mmio_range[0].beg + 4 * i);
--

2.20.1

Signature · 2 lines
With Best Regards,
Andy Shevchenko