diff options
author | Krzysztof Helt <krzysztof.h1@wp.pl> | 2008-10-16 01:03:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-16 14:21:42 -0400 |
commit | 0716a8eab3c8d21b4e36839fa0ee26abbf8e01ef (patch) | |
tree | 45781955355a69ed8461478e68acd2f17b9841f0 /drivers/video/neofb.c | |
parent | 4edad7f07048b681b0c633e471ad2532d592e876 (diff) |
neofb: kill some redundant code
Move common code outside if/else or switch/case clauses.
Drop checks done twice inside the neofb_check_var().
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/neofb.c')
-rw-r--r-- | drivers/video/neofb.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c index 6249960b9393..dea864552588 100644 --- a/drivers/video/neofb.c +++ b/drivers/video/neofb.c | |||
@@ -426,11 +426,11 @@ static void vgaHWProtect(int on) | |||
426 | { | 426 | { |
427 | unsigned char tmp; | 427 | unsigned char tmp; |
428 | 428 | ||
429 | tmp = vga_rseq(NULL, 0x01); | ||
429 | if (on) { | 430 | if (on) { |
430 | /* | 431 | /* |
431 | * Turn off screen and disable sequencer. | 432 | * Turn off screen and disable sequencer. |
432 | */ | 433 | */ |
433 | tmp = vga_rseq(NULL, 0x01); | ||
434 | vga_wseq(NULL, 0x00, 0x01); /* Synchronous Reset */ | 434 | vga_wseq(NULL, 0x00, 0x01); /* Synchronous Reset */ |
435 | vga_wseq(NULL, 0x01, tmp | 0x20); /* disable the display */ | 435 | vga_wseq(NULL, 0x01, tmp | 0x20); /* disable the display */ |
436 | 436 | ||
@@ -439,7 +439,6 @@ static void vgaHWProtect(int on) | |||
439 | /* | 439 | /* |
440 | * Reenable sequencer, then turn on screen. | 440 | * Reenable sequencer, then turn on screen. |
441 | */ | 441 | */ |
442 | tmp = vga_rseq(NULL, 0x01); | ||
443 | vga_wseq(NULL, 0x01, tmp & ~0x20); /* reenable display */ | 442 | vga_wseq(NULL, 0x01, tmp & ~0x20); /* reenable display */ |
444 | vga_wseq(NULL, 0x00, 0x03); /* clear synchronousreset */ | 443 | vga_wseq(NULL, 0x00, 0x03); /* clear synchronousreset */ |
445 | 444 | ||
@@ -648,10 +647,10 @@ neofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
648 | var->blue.msb_right = 0; | 647 | var->blue.msb_right = 0; |
649 | var->transp.msb_right = 0; | 648 | var->transp.msb_right = 0; |
650 | 649 | ||
650 | var->transp.offset = 0; | ||
651 | var->transp.length = 0; | ||
651 | switch (var->bits_per_pixel) { | 652 | switch (var->bits_per_pixel) { |
652 | case 8: /* PSEUDOCOLOUR, 256 */ | 653 | case 8: /* PSEUDOCOLOUR, 256 */ |
653 | var->transp.offset = 0; | ||
654 | var->transp.length = 0; | ||
655 | var->red.offset = 0; | 654 | var->red.offset = 0; |
656 | var->red.length = 8; | 655 | var->red.length = 8; |
657 | var->green.offset = 0; | 656 | var->green.offset = 0; |
@@ -661,8 +660,6 @@ neofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
661 | break; | 660 | break; |
662 | 661 | ||
663 | case 16: /* DIRECTCOLOUR, 64k */ | 662 | case 16: /* DIRECTCOLOUR, 64k */ |
664 | var->transp.offset = 0; | ||
665 | var->transp.length = 0; | ||
666 | var->red.offset = 11; | 663 | var->red.offset = 11; |
667 | var->red.length = 5; | 664 | var->red.length = 5; |
668 | var->green.offset = 5; | 665 | var->green.offset = 5; |
@@ -672,8 +669,6 @@ neofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
672 | break; | 669 | break; |
673 | 670 | ||
674 | case 24: /* TRUECOLOUR, 16m */ | 671 | case 24: /* TRUECOLOUR, 16m */ |
675 | var->transp.offset = 0; | ||
676 | var->transp.length = 0; | ||
677 | var->red.offset = 16; | 672 | var->red.offset = 16; |
678 | var->red.length = 8; | 673 | var->red.length = 8; |
679 | var->green.offset = 8; | 674 | var->green.offset = 8; |
@@ -704,8 +699,6 @@ neofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
704 | if (vramlen > 4 * 1024 * 1024) | 699 | if (vramlen > 4 * 1024 * 1024) |
705 | vramlen = 4 * 1024 * 1024; | 700 | vramlen = 4 * 1024 * 1024; |
706 | 701 | ||
707 | if (var->yres_virtual < var->yres) | ||
708 | var->yres_virtual = var->yres; | ||
709 | if (var->xres_virtual < var->xres) | 702 | if (var->xres_virtual < var->xres) |
710 | var->xres_virtual = var->xres; | 703 | var->xres_virtual = var->xres; |
711 | 704 | ||
@@ -722,8 +715,6 @@ neofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
722 | if it was possible. We should return -EINVAL, but I disagree */ | 715 | if it was possible. We should return -EINVAL, but I disagree */ |
723 | if (var->yres_virtual < var->yres) | 716 | if (var->yres_virtual < var->yres) |
724 | var->yres = var->yres_virtual; | 717 | var->yres = var->yres_virtual; |
725 | if (var->xres_virtual < var->xres) | ||
726 | var->xres = var->xres_virtual; | ||
727 | if (var->xoffset + var->xres > var->xres_virtual) | 718 | if (var->xoffset + var->xres > var->xres_virtual) |
728 | var->xoffset = var->xres_virtual - var->xres; | 719 | var->xoffset = var->xres_virtual - var->xres; |
729 | if (var->yoffset + var->yres > var->yres_virtual) | 720 | if (var->yoffset + var->yres > var->yres_virtual) |