staging: dgap: use dgap_release_remap() in dgap_cleanup_board()
authorDaeseok Youn <daeseok.youn@gmail.com>
Tue, 23 Sep 2014 00:22:36 +0000 (09:22 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Sep 2014 06:39:25 +0000 (23:39 -0700)
Just simply use dgap_release_remap() in dgap_cleanup_board() for
releasing map memory.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/dgap/dgap.c

index 637ea8af661f5d92798add894001e15eb33b0adf..d0be1cebf5a95e58b15a13bd05e97f2999e27533 100644 (file)
@@ -683,17 +683,7 @@ static void dgap_cleanup_board(struct board_t *brd)
 
        tasklet_kill(&brd->helper_tasklet);
 
-       if (brd->re_map_port) {
-               release_mem_region(brd->membase + 0x200000, 0x200000);
-               iounmap(brd->re_map_port);
-               brd->re_map_port = NULL;
-       }
-
-       if (brd->re_map_membase) {
-               release_mem_region(brd->membase, 0x200000);
-               iounmap(brd->re_map_membase);
-               brd->re_map_membase = NULL;
-       }
+       dgap_release_remap(brd);
 
        /* Free all allocated channels structs */
        for (i = 0; i < MAXPORTS ; i++)
@@ -1023,10 +1013,15 @@ static int dgap_do_remap(struct board_t *brd)
 
 static void dgap_release_remap(struct board_t *brd)
 {
-       release_mem_region(brd->membase, 0x200000);
-       release_mem_region(brd->membase + PCI_IO_OFFSET, 0x200000);
-       iounmap(brd->re_map_membase);
-       iounmap(brd->re_map_port);
+       if (brd->re_map_membase) {
+               release_mem_region(brd->membase, 0x200000);
+               iounmap(brd->re_map_membase);
+       }
+
+       if (brd->re_map_port) {
+               release_mem_region(brd->membase + PCI_IO_OFFSET, 0x200000);
+               iounmap(brd->re_map_port);
+       }
 }
 /*****************************************************************************
 *