Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af07daa0 authored by Alexey Khoroshilov's avatar Alexey Khoroshilov Committed by Greg Kroah-Hartman
Browse files

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: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 61a0bc0f
Loading
Loading
Loading
Loading
+33 −48
Original line number Diff line number Diff line
@@ -254,9 +254,6 @@ static int dgap_poll_tick = 20; /* Poll interval - 20 ms */
/*
 * Static vars.
 */
static int dgap_Major_Control_Registered = FALSE;
static uint dgap_driver_start = FALSE;

static struct class *dgap_class;

static struct board_t *dgap_BoardsByMajor[256];
@@ -551,10 +548,6 @@ static int dgap_start(void)
	int rc = 0;
	unsigned long flags;

	if (dgap_driver_start == FALSE) {

		dgap_driver_start = TRUE;

	/*
	 * make sure that the globals are
	 * init'd before we do anything else
@@ -568,12 +561,11 @@ static int dgap_start(void)
	/*
	 * Register our base character device into the kernel.
	 */
		if (!dgap_Major_Control_Registered) {

	/*
	 * Register management/dpa devices
	 */
			rc = register_chrdev(DIGI_DGAP_MAJOR, "dgap",
						 &DgapBoardFops);
	rc = register_chrdev(DIGI_DGAP_MAJOR, "dgap", &DgapBoardFops);
	if (rc < 0)
		return rc;

@@ -581,8 +573,6 @@ static int dgap_start(void)
	device_create(dgap_class, NULL,
		MKDEV(DIGI_DGAP_MAJOR, 0),
		NULL, "dgap_mgmt");
			dgap_Major_Control_Registered = TRUE;
		}

	/* Start the poller */
	DGAP_LOCK(dgap_poll_lock, flags);
@@ -596,7 +586,6 @@ static int dgap_start(void)
	add_timer(&dgap_poll_timer);

	dgap_driver_state = DRIVER_NEED_CONFIG_LOAD;
	}

	return rc;
}
@@ -658,13 +647,9 @@ static void dgap_cleanup_module(void)

	dgap_remove_driver_sysfiles(&dgap_driver);


	if (dgap_Major_Control_Registered) {
	device_destroy(dgap_class, MKDEV(DIGI_DGAP_MAJOR, 0));
		device_destroy(dgap_class, MKDEV(DIGI_DGAP_MAJOR, 1));
	class_destroy(dgap_class);
	unregister_chrdev(DIGI_DGAP_MAJOR, "dgap");
	}

	kfree(dgap_config_buf);