In a later patch we will remove the duplicate codes. But the code also
needs to execute dgap_remove_driver_sysfiles() if it is being called
from dgap_remove_one() but if being called fron the error path of the
dgap_init_module() then the sysfiles should not be removed.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kfree(brd);
}
-static void dgap_stop(void)
+static void dgap_stop(bool removesys, struct pci_driver *drv)
{
unsigned long lock_flags;
spin_unlock_irqrestore(&dgap_poll_lock, lock_flags);
del_timer_sync(&dgap_poll_timer);
+ if (removesys)
+ dgap_remove_driver_sysfiles(drv);
device_destroy(dgap_class, MKDEV(DIGI_DGAP_MAJOR, 0));
class_destroy(dgap_class);
rc = pci_register_driver(&dgap_driver);
if (rc) {
- dgap_stop();
+ dgap_stop(false, NULL);
return rc;
}