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

Commit d1c9f3ef authored by Sudip Mukherjee's avatar Sudip Mukherjee Committed by Greg Kroah-Hartman
Browse files

staging: dgap: move function before remove



move the cleanup function before the remove call as the next patch of
the series is going to use that.

Signed-off-by: default avatarSudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 76c80721
Loading
Loading
Loading
Loading
+30 −31
Original line number Diff line number Diff line
@@ -6987,6 +6987,36 @@ static int dgap_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
	return rc;
}

/*
 * dgap_cleanup_board()
 *
 * Free all the memory associated with a board
 */
static void dgap_cleanup_board(struct board_t *brd)
{
	unsigned int i;

	if (!brd || brd->magic != DGAP_BOARD_MAGIC)
		return;

	dgap_free_irq(brd);

	tasklet_kill(&brd->helper_tasklet);

	dgap_unmap(brd);

	/* Free all allocated channels structs */
	for (i = 0; i < MAXPORTS ; i++)
		kfree(brd->channels[i]);

	kfree(brd->flipbuf);
	kfree(brd->flipflagbuf);

	dgap_board[brd->boardnum] = NULL;

	kfree(brd);
}

static void dgap_remove_one(struct pci_dev *dev)
{
	/* Do Nothing */
@@ -7071,37 +7101,6 @@ static void dgap_stop(void)
	unregister_chrdev(DIGI_DGAP_MAJOR, "dgap");
}

/*
 * dgap_cleanup_board()
 *
 * Free all the memory associated with a board
 */
static void dgap_cleanup_board(struct board_t *brd)
{
	unsigned int i;

	if (!brd || brd->magic != DGAP_BOARD_MAGIC)
		return;

	dgap_free_irq(brd);

	tasklet_kill(&brd->helper_tasklet);

	dgap_unmap(brd);

	/* Free all allocated channels structs */
	for (i = 0; i < MAXPORTS ; i++)
		kfree(brd->channels[i]);

	kfree(brd->flipbuf);
	kfree(brd->flipflagbuf);

	dgap_board[brd->boardnum] = NULL;

	kfree(brd);
}


/************************************************************************
 *
 * Driver load/unload functions