From: Hari Prasath Gujulan Elango <hguju...@visteon.com>

The driver remove function is not the right place to cleanup resources
allocated in the driver module init.The cleanup is moved from remove
function to module exit as appropriate.

Signed-off-by: Hari Prasath Gujulan Elango <hguju...@visteon.com>
---
 drivers/staging/dgap/dgap.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 26b0446..185e9e5 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -7007,21 +7007,6 @@ static void dgap_cleanup_board(struct board_t *brd)
 static void dgap_remove_one(struct pci_dev *dev)
 {
        unsigned int i;
-       ulong lock_flags;
-       struct pci_driver *drv = to_pci_driver(dev->dev.driver);
-
-       spin_lock_irqsave(&dgap_poll_lock, lock_flags);
-       dgap_poll_stop = 1;
-       spin_unlock_irqrestore(&dgap_poll_lock, lock_flags);
-
-       /* Turn off poller right away. */
-       del_timer_sync(&dgap_poll_timer);
-
-       dgap_remove_driver_sysfiles(drv);
-
-       device_destroy(dgap_class, MKDEV(DIGI_DGAP_MAJOR, 0));
-       class_destroy(dgap_class);
-       unregister_chrdev(DIGI_DGAP_MAJOR, "dgap");
 
        for (i = 0; i < dgap_numboards; ++i) {
                dgap_remove_ports_sysfiles(dgap_board[i]);
@@ -7159,8 +7144,10 @@ err_stop:
  */
 static void dgap_cleanup_module(void)
 {
+       dgap_remove_driver_sysfiles(&dgap_driver);
        if (dgap_numboards)
                pci_unregister_driver(&dgap_driver);
+       dgap_stop();
 }
 
 module_init(dgap_init_module);
-- 
1.9.1
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to