mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Huewe <peterhuewe@gmx.de>
To: Arnaud Patard <arnaud.patard@rtp-net.org>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Aaro Koskinen" <aaro.koskinen@iki.fi>,
	"Peter Huewe" <peterhuewe@gmx.de>,
	"Miguel Gómez" <magomez@igalia.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH 5/5] staging/xgifb: Remove duplicated code in loops.
Date: Fri, 15 Feb 2013 20:37:13 +0100	[thread overview]
Message-ID: <1360957033-11876-5-git-send-email-peterhuewe@gmx.de> (raw)
In-Reply-To: <1360957033-11876-1-git-send-email-peterhuewe@gmx.de>

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>
---
 drivers/staging/xgifb/vb_setmode.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index edbe70b..dfa5303 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -5464,7 +5464,6 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
 
 	unsigned char CR17, CR63, SR31;
 	unsigned short temp;
-	unsigned char DAC_TEST_PARMS[3] = { 0x0F, 0x0F, 0x0F };
 
 	int i;
 	xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86);
@@ -5518,10 +5517,8 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
 
 	outb(0x00, pVBInfo->P3c8);
 
-	for (i = 0; i < 256; i++) {
-		outb((unsigned char) DAC_TEST_PARMS[0], (pVBInfo->P3c8 + 1));
-		outb((unsigned char) DAC_TEST_PARMS[1], (pVBInfo->P3c8 + 1));
-		outb((unsigned char) DAC_TEST_PARMS[2], (pVBInfo->P3c8 + 1));
+	for (i = 0; i < 256 * 3; i++) {
+		outb(0x0F, (pVBInfo->P3c8 + 1)); /* DAC_TEST_PARMS */
 	}
 
 	mdelay(1);
@@ -5537,9 +5534,7 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
 	/* avoid display something, set BLACK DAC if not restore DAC */
 	outb(0x00, pVBInfo->P3c8);
 
-	for (i = 0; i < 256; i++) {
-		outb(0, (pVBInfo->P3c8 + 1));
-		outb(0, (pVBInfo->P3c8 + 1));
+	for (i = 0; i < 256 * 3; i++) {
 		outb(0, (pVBInfo->P3c8 + 1));
 	}
 
-- 
1.7.8.6


  parent reply	other threads:[~2013-02-15 19:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-15 19:37 [PATCH 1/5] staging/xgifb: Consolidate if/else if with identical code branches Peter Huewe
2013-02-15 19:37 ` [PATCH 2/5] staging/xgifb: Remove unnecessary casts Peter Huewe
2013-02-15 19:37 ` [PATCH 3/5] staging/xgifb: Remove code without effect Peter Huewe
2013-02-18 11:25   ` Dan Carpenter
2013-02-15 19:37 ` [PATCH 4/5] staging/xgifb: Consolidate return paths Peter Huewe
2013-02-15 19:37 ` Peter Huewe [this message]
2013-02-18 11:18   ` [PATCH 5/5] staging/xgifb: Remove duplicated code in loops Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1360957033-11876-5-git-send-email-peterhuewe@gmx.de \
    --to=peterhuewe@gmx.de \
    --cc=aaro.koskinen@iki.fi \
    --cc=arnaud.patard@rtp-net.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=magomez@igalia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®