the dev_t was being stored in visorchipset_platform_device.dev.devt while initializing the module. so pass that value as an argument to cleanup() so that it can use this local variable instead of the global variable. Signed-off-by: Sudip Mukherjee <sudip@xxxxxxxxxxxxxxx> --- v5: reordered the patch series v4: messed up the subject in v3 v3: broke the previous patch in series drivers/staging/unisys/visorchipset/file.c | 6 +++--- drivers/staging/unisys/visorchipset/file.h | 2 +- drivers/staging/unisys/visorchipset/visorchipset_main.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c index 6ebe7f7..257cfdd 100644 --- a/drivers/staging/unisys/visorchipset/file.c +++ b/drivers/staging/unisys/visorchipset/file.c @@ -73,13 +73,13 @@ visorchipset_file_init(dev_t major_dev, struct visorchannel **controlvm_channel) } void -visorchipset_file_cleanup(void) +visorchipset_file_cleanup(dev_t major_dev) { if (file_cdev.ops != NULL) cdev_del(&file_cdev); file_cdev.ops = NULL; - if (MAJOR(majordev) >= 0) { - unregister_chrdev_region(majordev, 1); + if (MAJOR(major_dev) >= 0) { + unregister_chrdev_region(major_dev, 1); majordev = MKDEV(0, 0); } } diff --git a/drivers/staging/unisys/visorchipset/file.h b/drivers/staging/unisys/visorchipset/file.h index dc7a195..51f7699 100644 --- a/drivers/staging/unisys/visorchipset/file.h +++ b/drivers/staging/unisys/visorchipset/file.h @@ -22,6 +22,6 @@ int visorchipset_file_init(dev_t majorDev, struct visorchannel **pControlVm_channel); -void visorchipset_file_cleanup(void); +void visorchipset_file_cleanup(dev_t major_dev); #endif diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 9c8605d..f2663d2c 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -2278,7 +2278,7 @@ visorchipset_exit(void) visorchannel_destroy(controlvm_channel); - visorchipset_file_cleanup(); + visorchipset_file_cleanup(visorchipset_platform_device.dev.devt); POSTCODE_LINUX_2(DRIVER_EXIT_PC, POSTCODE_SEVERITY_INFO); } -- 1.8.1.2 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel