staging: dgap: remove unneeded status variables

dgap_driver_start and dgap_Major_Control_Registered are used
to keep status of initialization of the driver as a whole and its "Major Control".
But the code that checks them is executed once on module init/unload.
That makes no sense in these variables as far as their values are predictable
at any time.

Also "dgap_downld" device was removed, while
device_destroy(MKDEV(DIGI_DGAP_MAJOR, 1)) is still in dgap_cleanup_module().
The patch removes it by the way.

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Alexey Khoroshilov 2014-03-09 01:01:33 +04:00 committed by Greg Kroah-Hartman
parent 61a0bc0f1f
commit af07daa0af
1 changed files with 33 additions and 48 deletions

View File

@ -254,9 +254,6 @@ static int dgap_poll_tick = 20; /* Poll interval - 20 ms */
/* /*
* Static vars. * Static vars.
*/ */
static int dgap_Major_Control_Registered = FALSE;
static uint dgap_driver_start = FALSE;
static struct class *dgap_class; static struct class *dgap_class;
static struct board_t *dgap_BoardsByMajor[256]; static struct board_t *dgap_BoardsByMajor[256];
@ -551,52 +548,44 @@ static int dgap_start(void)
int rc = 0; int rc = 0;
unsigned long flags; unsigned long flags;
if (dgap_driver_start == FALSE) { /*
* make sure that the globals are
* init'd before we do anything else
*/
dgap_init_globals();
dgap_driver_start = TRUE; dgap_NumBoards = 0;
/* pr_info("For the tools package please visit http://www.digi.com\n");
* make sure that the globals are
* init'd before we do anything else
*/
dgap_init_globals();
dgap_NumBoards = 0; /*
* Register our base character device into the kernel.
*/
pr_info("For the tools package please visit http://www.digi.com\n"); /*
* Register management/dpa devices
*/
rc = register_chrdev(DIGI_DGAP_MAJOR, "dgap", &DgapBoardFops);
if (rc < 0)
return rc;
/* dgap_class = class_create(THIS_MODULE, "dgap_mgmt");
* Register our base character device into the kernel. device_create(dgap_class, NULL,
*/ MKDEV(DIGI_DGAP_MAJOR, 0),
if (!dgap_Major_Control_Registered) { NULL, "dgap_mgmt");
/*
* Register management/dpa devices
*/
rc = register_chrdev(DIGI_DGAP_MAJOR, "dgap",
&DgapBoardFops);
if (rc < 0)
return rc;
dgap_class = class_create(THIS_MODULE, "dgap_mgmt"); /* Start the poller */
device_create(dgap_class, NULL, DGAP_LOCK(dgap_poll_lock, flags);
MKDEV(DIGI_DGAP_MAJOR, 0), init_timer(&dgap_poll_timer);
NULL, "dgap_mgmt"); dgap_poll_timer.function = dgap_poll_handler;
dgap_Major_Control_Registered = TRUE; dgap_poll_timer.data = 0;
} dgap_poll_time = jiffies + dgap_jiffies_from_ms(dgap_poll_tick);
dgap_poll_timer.expires = dgap_poll_time;
DGAP_UNLOCK(dgap_poll_lock, flags);
/* Start the poller */ add_timer(&dgap_poll_timer);
DGAP_LOCK(dgap_poll_lock, flags);
init_timer(&dgap_poll_timer);
dgap_poll_timer.function = dgap_poll_handler;
dgap_poll_timer.data = 0;
dgap_poll_time = jiffies + dgap_jiffies_from_ms(dgap_poll_tick);
dgap_poll_timer.expires = dgap_poll_time;
DGAP_UNLOCK(dgap_poll_lock, flags);
add_timer(&dgap_poll_timer); dgap_driver_state = DRIVER_NEED_CONFIG_LOAD;
dgap_driver_state = DRIVER_NEED_CONFIG_LOAD;
}
return rc; return rc;
} }
@ -658,13 +647,9 @@ static void dgap_cleanup_module(void)
dgap_remove_driver_sysfiles(&dgap_driver); dgap_remove_driver_sysfiles(&dgap_driver);
device_destroy(dgap_class, MKDEV(DIGI_DGAP_MAJOR, 0));
if (dgap_Major_Control_Registered) { class_destroy(dgap_class);
device_destroy(dgap_class, MKDEV(DIGI_DGAP_MAJOR, 0)); unregister_chrdev(DIGI_DGAP_MAJOR, "dgap");
device_destroy(dgap_class, MKDEV(DIGI_DGAP_MAJOR, 1));
class_destroy(dgap_class);
unregister_chrdev(DIGI_DGAP_MAJOR, "dgap");
}
kfree(dgap_config_buf); kfree(dgap_config_buf);