Merge tag 'v3.10.107' into update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / video / console / fbcon.c
index a92783e480e66b60755dc0dcc3052d2d75d17fe1..ca55f93b0f623d74f04f045f4d762433600d4545 100644 (file)
@@ -1196,6 +1196,8 @@ static void fbcon_free_font(struct display *p, bool freefont)
        p->userfont = 0;
 }
 
+static void set_vc_hi_font(struct vc_data *vc, bool set);
+
 static void fbcon_deinit(struct vc_data *vc)
 {
        struct display *p = &fb_display[vc->vc_num];
@@ -1231,6 +1233,9 @@ finished:
        if (free_font)
                vc->vc_font.data = NULL;
 
+       if (vc->vc_hi_font_mask)
+               set_vc_hi_font(vc, false);
+
        if (!con_is_bound(&fb_con))
                fbcon_exit();
 
@@ -2466,32 +2471,10 @@ static int fbcon_get_font(struct vc_data *vc, struct console_font *font)
        return 0;
 }
 
-static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
-                            const u8 * data, int userfont)
+/* set/clear vc_hi_font_mask and update vc attrs accordingly */
+static void set_vc_hi_font(struct vc_data *vc, bool set)
 {
-       struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
-       struct fbcon_ops *ops = info->fbcon_par;
-       struct display *p = &fb_display[vc->vc_num];
-       int resize;
-       int cnt;
-       char *old_data = NULL;
-
-       if (CON_IS_VISIBLE(vc) && softback_lines)
-               fbcon_set_origin(vc);
-
-       resize = (w != vc->vc_font.width) || (h != vc->vc_font.height);
-       if (p->userfont)
-               old_data = vc->vc_font.data;
-       if (userfont)
-               cnt = FNTCHARCNT(data);
-       else
-               cnt = 256;
-       vc->vc_font.data = (void *)(p->fontdata = data);
-       if ((p->userfont = userfont))
-               REFCOUNT(data)++;
-       vc->vc_font.width = w;
-       vc->vc_font.height = h;
-       if (vc->vc_hi_font_mask && cnt == 256) {
+       if (!set) {
                vc->vc_hi_font_mask = 0;
                if (vc->vc_can_do_color) {
                        vc->vc_complement_mask >>= 1;
@@ -2514,7 +2497,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
                            ((c & 0xfe00) >> 1) | (c & 0xff);
                        vc->vc_attr >>= 1;
                }
-       } else if (!vc->vc_hi_font_mask && cnt == 512) {
+       } else {
                vc->vc_hi_font_mask = 0x100;
                if (vc->vc_can_do_color) {
                        vc->vc_complement_mask <<= 1;
@@ -2546,8 +2529,38 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
                        } else
                                vc->vc_video_erase_char = c & ~0x100;
                }
-
        }
+}
+
+static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
+                            const u8 * data, int userfont)
+{
+       struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
+       struct fbcon_ops *ops = info->fbcon_par;
+       struct display *p = &fb_display[vc->vc_num];
+       int resize;
+       int cnt;
+       char *old_data = NULL;
+
+       if (CON_IS_VISIBLE(vc) && softback_lines)
+               fbcon_set_origin(vc);
+
+       resize = (w != vc->vc_font.width) || (h != vc->vc_font.height);
+       if (p->userfont)
+               old_data = vc->vc_font.data;
+       if (userfont)
+               cnt = FNTCHARCNT(data);
+       else
+               cnt = 256;
+       vc->vc_font.data = (void *)(p->fontdata = data);
+       if ((p->userfont = userfont))
+               REFCOUNT(data)++;
+       vc->vc_font.width = w;
+       vc->vc_font.height = h;
+       if (vc->vc_hi_font_mask && cnt == 256)
+               set_vc_hi_font(vc, false);
+       else if (!vc->vc_hi_font_mask && cnt == 512)
+               set_vc_hi_font(vc, true);
 
        if (resize) {
                int cols, rows;