vgacon: prevent vgacon_deinit from touching the hardware for inactive consoles.
[linux-block.git] / drivers / video / console / vgacon.c
index 74e96cf83b7e78af48e22013be8127cb3315acb0..da55ccaf4d55043bc3889bdba7feff1b6326213b 100644 (file)
@@ -589,12 +589,14 @@ static void vgacon_init(struct vc_data *c, int init)
 
 static void vgacon_deinit(struct vc_data *c)
 {
-       /* When closing the last console, reset video origin */
-       if (!--vgacon_uni_pagedir[1]) {
+       /* When closing the active console, reset video origin */
+       if (CON_IS_VISIBLE(c)) {
                c->vc_visible_origin = vga_vram_base;
                vga_set_mem_top(c);
-               con_free_unimap(c);
        }
+
+       if (!--vgacon_uni_pagedir[1])
+               con_free_unimap(c);
        c->vc_uni_pagedir_loc = &c->vc_uni_pagedir;
        con_set_default_unimap(c);
 }