Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 771f3eed authored by Peter Huewe's avatar Peter Huewe Committed by Greg Kroah-Hartman
Browse files

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: default avatarPeter Huewe <peterhuewe@gmx.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 053004b3
Loading
Loading
Loading
Loading
+3 −8
Original line number Original line Diff line number Diff line
@@ -5464,7 +5464,6 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo)


	unsigned char CR17, CR63, SR31;
	unsigned char CR17, CR63, SR31;
	unsigned short temp;
	unsigned short temp;
	unsigned char DAC_TEST_PARMS[3] = { 0x0F, 0x0F, 0x0F };


	int i;
	int i;
	xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86);
	xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86);
@@ -5518,10 +5517,8 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo)


	outb(0x00, pVBInfo->P3c8);
	outb(0x00, pVBInfo->P3c8);


	for (i = 0; i < 256; i++) {
	for (i = 0; i < 256 * 3; i++) {
		outb((unsigned char) DAC_TEST_PARMS[0], (pVBInfo->P3c8 + 1));
		outb(0x0F, (pVBInfo->P3c8 + 1)); /* DAC_TEST_PARMS */
		outb((unsigned char) DAC_TEST_PARMS[1], (pVBInfo->P3c8 + 1));
		outb((unsigned char) DAC_TEST_PARMS[2], (pVBInfo->P3c8 + 1));
	}
	}


	mdelay(1);
	mdelay(1);
@@ -5537,9 +5534,7 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
	/* avoid display something, set BLACK DAC if not restore DAC */
	/* avoid display something, set BLACK DAC if not restore DAC */
	outb(0x00, pVBInfo->P3c8);
	outb(0x00, pVBInfo->P3c8);


	for (i = 0; i < 256; i++) {
	for (i = 0; i < 256 * 3; i++) {
		outb(0, (pVBInfo->P3c8 + 1));
		outb(0, (pVBInfo->P3c8 + 1));
		outb(0, (pVBInfo->P3c8 + 1));
		outb(0, (pVBInfo->P3c8 + 1));
	}
	}