aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/vt
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-05-13 06:09:28 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-28 16:37:21 -0400
commite4bdab70dd07d8648a1ec3e029239aa86eb836b6 (patch)
tree24ef32821f30f9f11e935716e4e25b7ab8c134c5 /drivers/tty/vt
parent0f2893f0d1acff4bb1677b60c0486adc0075cb99 (diff)
console: Use explicit pointer type for vc_uni_pagedir* fields
The vc_data.vc_uni_pagedir filed is currently long int, supposedly to be served generically. This, however, leads to lots of cast to pointer, and rather it worsens the readability significantly. Actually, we have now only a single uni_pagedir map implementation, and this won't change likely. So, it'd be much more simple and error-prone to just use the exact pointer for struct uni_pagedir instead of long. Ditto for vc_uni_pagedir_loc. It's a pointer to the uni_pagedir, thus it can be changed similarly to the exact type. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/vt')
-rw-r--r--drivers/tty/vt/consolemap.c38
-rw-r--r--drivers/tty/vt/vt.c2
2 files changed, 20 insertions, 20 deletions
diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c
index 2978ca596a7f..3fdc786b6b2f 100644
--- a/drivers/tty/vt/consolemap.c
+++ b/drivers/tty/vt/consolemap.c
@@ -262,7 +262,7 @@ u16 inverse_translate(struct vc_data *conp, int glyph, int use_unicode)
262 int m; 262 int m;
263 if (glyph < 0 || glyph >= MAX_GLYPH) 263 if (glyph < 0 || glyph >= MAX_GLYPH)
264 return 0; 264 return 0;
265 else if (!(p = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc)) 265 else if (!(p = *conp->vc_uni_pagedir_loc))
266 return glyph; 266 return glyph;
267 else if (use_unicode) { 267 else if (use_unicode) {
268 if (!p->inverse_trans_unicode) 268 if (!p->inverse_trans_unicode)
@@ -287,7 +287,7 @@ static void update_user_maps(void)
287 for (i = 0; i < MAX_NR_CONSOLES; i++) { 287 for (i = 0; i < MAX_NR_CONSOLES; i++) {
288 if (!vc_cons_allocated(i)) 288 if (!vc_cons_allocated(i))
289 continue; 289 continue;
290 p = (struct uni_pagedir *)*vc_cons[i].d->vc_uni_pagedir_loc; 290 p = *vc_cons[i].d->vc_uni_pagedir_loc;
291 if (p && p != q) { 291 if (p && p != q) {
292 set_inverse_transl(vc_cons[i].d, p, USER_MAP); 292 set_inverse_transl(vc_cons[i].d, p, USER_MAP);
293 set_inverse_trans_unicode(vc_cons[i].d, p); 293 set_inverse_trans_unicode(vc_cons[i].d, p);
@@ -418,10 +418,10 @@ void con_free_unimap(struct vc_data *vc)
418{ 418{
419 struct uni_pagedir *p; 419 struct uni_pagedir *p;
420 420
421 p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; 421 p = *vc->vc_uni_pagedir_loc;
422 if (!p) 422 if (!p)
423 return; 423 return;
424 *vc->vc_uni_pagedir_loc = 0; 424 *vc->vc_uni_pagedir_loc = NULL;
425 if (--p->refcount) 425 if (--p->refcount)
426 return; 426 return;
427 con_release_unimap(p); 427 con_release_unimap(p);
@@ -436,7 +436,7 @@ static int con_unify_unimap(struct vc_data *conp, struct uni_pagedir *p)
436 for (i = 0; i < MAX_NR_CONSOLES; i++) { 436 for (i = 0; i < MAX_NR_CONSOLES; i++) {
437 if (!vc_cons_allocated(i)) 437 if (!vc_cons_allocated(i))
438 continue; 438 continue;
439 q = (struct uni_pagedir *)*vc_cons[i].d->vc_uni_pagedir_loc; 439 q = *vc_cons[i].d->vc_uni_pagedir_loc;
440 if (!q || q == p || q->sum != p->sum) 440 if (!q || q == p || q->sum != p->sum)
441 continue; 441 continue;
442 for (j = 0; j < 32; j++) { 442 for (j = 0; j < 32; j++) {
@@ -459,7 +459,7 @@ static int con_unify_unimap(struct vc_data *conp, struct uni_pagedir *p)
459 } 459 }
460 if (j == 32) { 460 if (j == 32) {
461 q->refcount++; 461 q->refcount++;
462 *conp->vc_uni_pagedir_loc = (unsigned long)q; 462 *conp->vc_uni_pagedir_loc = q;
463 con_release_unimap(p); 463 con_release_unimap(p);
464 kfree(p); 464 kfree(p);
465 return 1; 465 return 1;
@@ -500,7 +500,7 @@ static int con_do_clear_unimap(struct vc_data *vc, struct unimapinit *ui)
500{ 500{
501 struct uni_pagedir *p, *q; 501 struct uni_pagedir *p, *q;
502 502
503 p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; 503 p = *vc->vc_uni_pagedir_loc;
504 if (p && p->readonly) 504 if (p && p->readonly)
505 return -EIO; 505 return -EIO;
506 506
@@ -512,7 +512,7 @@ static int con_do_clear_unimap(struct vc_data *vc, struct unimapinit *ui)
512 return -ENOMEM; 512 return -ENOMEM;
513 } 513 }
514 q->refcount=1; 514 q->refcount=1;
515 *vc->vc_uni_pagedir_loc = (unsigned long)q; 515 *vc->vc_uni_pagedir_loc = q;
516 } else { 516 } else {
517 if (p == dflt) dflt = NULL; 517 if (p == dflt) dflt = NULL;
518 p->refcount++; 518 p->refcount++;
@@ -539,7 +539,7 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
539 console_lock(); 539 console_lock();
540 540
541 /* Save original vc_unipagdir_loc in case we allocate a new one */ 541 /* Save original vc_unipagdir_loc in case we allocate a new one */
542 p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; 542 p = *vc->vc_uni_pagedir_loc;
543 if (p->readonly) { 543 if (p->readonly) {
544 console_unlock(); 544 console_unlock();
545 return -EIO; 545 return -EIO;
@@ -564,7 +564,7 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
564 * Since refcount was > 1, con_clear_unimap() allocated a 564 * Since refcount was > 1, con_clear_unimap() allocated a
565 * a new uni_pagedir for this vc. Re: p != q 565 * a new uni_pagedir for this vc. Re: p != q
566 */ 566 */
567 q = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; 567 q = *vc->vc_uni_pagedir_loc;
568 568
569 /* 569 /*
570 * uni_pgdir is a 32*32*64 table with rows allocated 570 * uni_pgdir is a 32*32*64 table with rows allocated
@@ -586,7 +586,7 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
586 err1 = con_insert_unipair(q, l, p2[k]); 586 err1 = con_insert_unipair(q, l, p2[k]);
587 if (err1) { 587 if (err1) {
588 p->refcount++; 588 p->refcount++;
589 *vc->vc_uni_pagedir_loc = (unsigned long)p; 589 *vc->vc_uni_pagedir_loc = p;
590 con_release_unimap(q); 590 con_release_unimap(q);
591 kfree(q); 591 kfree(q);
592 console_unlock(); 592 console_unlock();
@@ -655,12 +655,12 @@ int con_set_default_unimap(struct vc_data *vc)
655 struct uni_pagedir *p; 655 struct uni_pagedir *p;
656 656
657 if (dflt) { 657 if (dflt) {
658 p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; 658 p = *vc->vc_uni_pagedir_loc;
659 if (p == dflt) 659 if (p == dflt)
660 return 0; 660 return 0;
661 661
662 dflt->refcount++; 662 dflt->refcount++;
663 *vc->vc_uni_pagedir_loc = (unsigned long)dflt; 663 *vc->vc_uni_pagedir_loc = dflt;
664 if (p && !--p->refcount) { 664 if (p && !--p->refcount) {
665 con_release_unimap(p); 665 con_release_unimap(p);
666 kfree(p); 666 kfree(p);
@@ -674,7 +674,7 @@ int con_set_default_unimap(struct vc_data *vc)
674 if (err) 674 if (err)
675 return err; 675 return err;
676 676
677 p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; 677 p = *vc->vc_uni_pagedir_loc;
678 q = dfont_unitable; 678 q = dfont_unitable;
679 679
680 for (i = 0; i < 256; i++) 680 for (i = 0; i < 256; i++)
@@ -685,7 +685,7 @@ int con_set_default_unimap(struct vc_data *vc)
685 } 685 }
686 686
687 if (con_unify_unimap(vc, p)) { 687 if (con_unify_unimap(vc, p)) {
688 dflt = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; 688 dflt = *vc->vc_uni_pagedir_loc;
689 return err; 689 return err;
690 } 690 }
691 691
@@ -713,9 +713,9 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc)
713 if (*dst_vc->vc_uni_pagedir_loc == *src_vc->vc_uni_pagedir_loc) 713 if (*dst_vc->vc_uni_pagedir_loc == *src_vc->vc_uni_pagedir_loc)
714 return 0; 714 return 0;
715 con_free_unimap(dst_vc); 715 con_free_unimap(dst_vc);
716 q = (struct uni_pagedir *)*src_vc->vc_uni_pagedir_loc; 716 q = *src_vc->vc_uni_pagedir_loc;
717 q->refcount++; 717 q->refcount++;
718 *dst_vc->vc_uni_pagedir_loc = (long)q; 718 *dst_vc->vc_uni_pagedir_loc = q;
719 return 0; 719 return 0;
720} 720}
721EXPORT_SYMBOL(con_copy_unimap); 721EXPORT_SYMBOL(con_copy_unimap);
@@ -737,7 +737,7 @@ int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, struct uni
737 737
738 ect = 0; 738 ect = 0;
739 if (*vc->vc_uni_pagedir_loc) { 739 if (*vc->vc_uni_pagedir_loc) {
740 p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; 740 p = *vc->vc_uni_pagedir_loc;
741 for (i = 0; i < 32; i++) 741 for (i = 0; i < 32; i++)
742 if ((p1 = p->uni_pgdir[i])) 742 if ((p1 = p->uni_pgdir[i]))
743 for (j = 0; j < 32; j++) 743 for (j = 0; j < 32; j++)
@@ -810,7 +810,7 @@ conv_uni_to_pc(struct vc_data *conp, long ucs)
810 if (!*conp->vc_uni_pagedir_loc) 810 if (!*conp->vc_uni_pagedir_loc)
811 return -3; 811 return -3;
812 812
813 p = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc; 813 p = *conp->vc_uni_pagedir_loc;
814 if ((p1 = p->uni_pgdir[ucs >> 11]) && 814 if ((p1 = p->uni_pgdir[ucs >> 11]) &&
815 (p2 = p1[(ucs >> 6) & 0x1f]) && 815 (p2 = p1[(ucs >> 6) & 0x1f]) &&
816 (h = p2[ucs & 0x3f]) < MAX_GLYPH) 816 (h = p2[ucs & 0x3f]) < MAX_GLYPH)
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 5149a72a84ff..5e0f6ff2e2f5 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -735,7 +735,7 @@ static void visual_init(struct vc_data *vc, int num, int init)
735 vc->vc_num = num; 735 vc->vc_num = num;
736 vc->vc_display_fg = &master_display_fg; 736 vc->vc_display_fg = &master_display_fg;
737 vc->vc_uni_pagedir_loc = &vc->vc_uni_pagedir; 737 vc->vc_uni_pagedir_loc = &vc->vc_uni_pagedir;
738 vc->vc_uni_pagedir = 0; 738 vc->vc_uni_pagedir = NULL;
739 vc->vc_hi_font_mask = 0; 739 vc->vc_hi_font_mask = 0;
740 vc->vc_complement_mask = 0; 740 vc->vc_complement_mask = 0;
741 vc->vc_can_do_color = 0; 741 vc->vc_can_do_color = 0;