Skip to contentSkip to conversation

block: sx8: use module_pci_driver()

PATCH New Jingoo Han 1 participant 2 messages Sep 16, 2013 Block layer

lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH 1/2 block: sx8: use module_pci_driver()

Use module_pci_driver() macro which makes the code smaller and simpler.

---
 drivers/block/sx8.c |   15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
drivers/block/sx8.c +1 -14
index 3fb6ab4..7b2ac95 100644
@@ -1747,17 +1747,4 @@ static void carm_remove_one (struct pci_dev *pdev)
 	pci_set_drvdata(pdev, NULL);
 }
 
-static int __init carm_init(void)
-{
-	return pci_register_driver(&carm_driver);
-}
-
-static void __exit carm_exit(void)
-{
-	pci_unregister_driver(&carm_driver);
-}
-
-module_init(carm_init);
-module_exit(carm_exit);
-
-
+module_pci_driver(carm_driver);
Signature · 1 line
1.7.10.4
author
#1 lore raw

PATCH 2/2 block: sx8: remove unnecessary pci_set_drvdata()

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/block/sx8.c |    1 -
 1 file changed, 1 deletion(-)
drivers/block/sx8.c +0 -1
index 7b2ac95..d5e2d12 100644
@@ -1744,7 +1744,6 @@ static void carm_remove_one (struct pci_dev *pdev)
 	kfree(host);
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);
-	pci_set_drvdata(pdev, NULL);
 }
 
 module_pci_driver(carm_driver);
Signature · 1 line
1.7.10.4