Skip to contentSkip to conversation

memstick: r592: Use dev_get_drvdata

PATCH In review Chuhong Yuan 2 participants 2 messages Jul 23, 2019 – Jul 24, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 memstick: r592: Use dev_get_drvdata

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

---
 drivers/memstick/host/r592.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/memstick/host/r592.c +2 -4
index 2932f421b3ea..dd3a1f3dcc19 100644
@@ -847,8 +847,7 @@ static void r592_remove(struct pci_dev *pdev)
 #ifdef CONFIG_PM_SLEEP
 static int r592_suspend(struct device *core_dev)
 {
-	struct pci_dev *pdev = to_pci_dev(core_dev);
-	struct r592_device *dev = pci_get_drvdata(pdev);
+	struct r592_device *dev = dev_get_drvdata(core_dev);
 
 	r592_clear_interrupts(dev);
 	memstick_suspend_host(dev->host);
@@ -858,8 +857,7 @@ static int r592_suspend(struct device *core_dev)
 
 static int r592_resume(struct device *core_dev)
 {
-	struct pci_dev *pdev = to_pci_dev(core_dev);
-	struct r592_device *dev = pci_get_drvdata(pdev);
+	struct r592_device *dev = dev_get_drvdata(core_dev);
 
 	r592_clear_interrupts(dev);
 	r592_enable_device(dev, false);
Signature · 1 line
2.20.1
#1 lore raw
Quoted 5 lines · Chuhong Yuan

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

Applied for next, thanks!

Kind regards
Uffe

Quoted 31 lines
---
 drivers/memstick/host/r592.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/memstick/host/r592.c +2 -5
index 2932f421b3ea..dd3a1f3dcc19 100644
@@ -847,8 +847,7 @@ static void r592_remove(struct pci_dev *pdev)
 #ifdef CONFIG_PM_SLEEP
 static int r592_suspend(struct device *core_dev)
 {
-       struct pci_dev *pdev = to_pci_dev(core_dev);
-       struct r592_device *dev = pci_get_drvdata(pdev);
+       struct r592_device *dev = dev_get_drvdata(core_dev);
 
        r592_clear_interrupts(dev);
        memstick_suspend_host(dev->host);
@@ -858,8 +857,7 @@ static int r592_suspend(struct device *core_dev)
 
 static int r592_resume(struct device *core_dev)
 {
-       struct pci_dev *pdev = to_pci_dev(core_dev);
-       struct r592_device *dev = pci_get_drvdata(pdev);
+       struct r592_device *dev = dev_get_drvdata(core_dev);
 
        r592_clear_interrupts(dev);
        r592_enable_device(dev, false);
--

2.20.1