Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging/xgifb: Remove duplicated code in loops.

Instead of calling the same function three times in a loop, multiply the
loop counter by three.
And since the value in DAC_TEST_PARMS is always the same we can use the
value directly.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Peter Huewe and committed by
Greg Kroah-Hartman
771f3eed 053004b3

+3 -8
+3 -8
drivers/staging/xgifb/vb_setmode.c
··· 5464 5464 5465 5465 unsigned char CR17, CR63, SR31; 5466 5466 unsigned short temp; 5467 - unsigned char DAC_TEST_PARMS[3] = { 0x0F, 0x0F, 0x0F }; 5468 5467 5469 5468 int i; 5470 5469 xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86); ··· 5517 5518 5518 5519 outb(0x00, pVBInfo->P3c8); 5519 5520 5520 - for (i = 0; i < 256; i++) { 5521 - outb((unsigned char) DAC_TEST_PARMS[0], (pVBInfo->P3c8 + 1)); 5522 - outb((unsigned char) DAC_TEST_PARMS[1], (pVBInfo->P3c8 + 1)); 5523 - outb((unsigned char) DAC_TEST_PARMS[2], (pVBInfo->P3c8 + 1)); 5521 + for (i = 0; i < 256 * 3; i++) { 5522 + outb(0x0F, (pVBInfo->P3c8 + 1)); /* DAC_TEST_PARMS */ 5524 5523 } 5525 5524 5526 5525 mdelay(1); ··· 5534 5537 /* avoid display something, set BLACK DAC if not restore DAC */ 5535 5538 outb(0x00, pVBInfo->P3c8); 5536 5539 5537 - for (i = 0; i < 256; i++) { 5538 - outb(0, (pVBInfo->P3c8 + 1)); 5539 - outb(0, (pVBInfo->P3c8 + 1)); 5540 + for (i = 0; i < 256 * 3; i++) { 5540 5541 outb(0, (pVBInfo->P3c8 + 1)); 5541 5542 } 5542 5543