From: Peter Huewe <peterhuewe@gmx.de>
To: Arnaud Patard <arnaud.patard@rtp-net.org>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Miguel Gómez" <magomez@igalia.com>,
"Aaro Koskinen" <aaro.koskinen@iki.fi>,
"Peter Huewe" <peterhuewe@gmx.de>,
"Sam Hansen" <solid.se7en@gmail.com>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH 07/10] staging/xgifb: remove unnecessary temp variable in XGIfb_mode_rate_to_ddata
Date: Sun, 3 Feb 2013 22:54:36 +0100 [thread overview]
Message-ID: <1359928479-8484-7-git-send-email-peterhuewe@gmx.de> (raw)
In-Reply-To: <1359928479-8484-1-git-send-email-peterhuewe@gmx.de>
Instead of subtracting one and then assign a different name and add 1
again we simply use HDE directly. HDE wasn't used directly before, so no
change in functionality.
Same applies to VDE.
-> now we can remove the variable with the very descriptive name E ;)
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
drivers/staging/xgifb/XGI_main_26.c | 20 +++++++++-----------
1 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index 840b497..387d1bd 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -94,7 +94,7 @@ static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr,
unsigned short VRE, VBE, VRS, VDE;
unsigned short HRE, HBE, HRS, HDE;
unsigned char sr_data, cr_data, cr_data2;
- int B, C, D, E, F, temp, j;
+ int B, C, D, F, temp, j;
InitTo330Pointer(HwDeviceExtension->jChipType, XGI_Pr);
if (!XGI_SearchModeID(ModeNo, &ModeIdIndex, XGI_Pr))
return 0;
@@ -104,14 +104,13 @@ static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr,
sr_data = XGI_CRT1Table[index].CR[5];
- HDE = (XGI330_RefIndex[RefreshRateTableIndex].XRes >> 3) - 1;
- E = HDE + 1;
+ HDE = (XGI330_RefIndex[RefreshRateTableIndex].XRes >> 3);
cr_data = XGI_CRT1Table[index].CR[3];
/* Horizontal retrace (=sync) start */
HRS = (cr_data & 0xff) | ((unsigned short) (sr_data & 0xC0) << 2);
- F = HRS - E - 3;
+ F = HRS - HDE - 3;
sr_data = XGI_CRT1Table[index].CR[6];
@@ -126,10 +125,10 @@ static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr,
/* Horizontal retrace (=sync) end */
HRE = (cr_data2 & 0x1f) | ((sr_data & 0x04) << 3);
- temp = HBE - ((E - 1) & 255);
+ temp = HBE - ((HDE - 1) & 255);
B = (temp > 0) ? temp : (temp + 256);
- temp = HRE - ((E + F + 3) & 63);
+ temp = HRE - ((HDE + F + 3) & 63);
C = (temp > 0) ? temp : (temp + 64);
D = B - F - C;
@@ -142,8 +141,7 @@ static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr,
cr_data2 = XGI_CRT1Table[index].CR[9];
- VDE = XGI330_RefIndex[RefreshRateTableIndex].YRes - 1;
- E = VDE + 1;
+ VDE = XGI330_RefIndex[RefreshRateTableIndex].YRes;
cr_data = XGI_CRT1Table[index].CR[10];
@@ -151,20 +149,20 @@ static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr,
VRS = (cr_data & 0xff) | ((unsigned short) (cr_data2 & 0x04) << 6)
| ((unsigned short) (cr_data2 & 0x80) << 2)
| ((unsigned short) (sr_data & 0x08) << 7);
- F = VRS + 1 - E;
+ F = VRS + 1 - VDE;
cr_data = XGI_CRT1Table[index].CR[13];
/* Vertical blank end */
VBE = (cr_data & 0xff) | ((unsigned short) (sr_data & 0x10) << 4);
- temp = VBE - ((E - 1) & 511);
+ temp = VBE - ((VDE - 1) & 511);
B = (temp > 0) ? temp : (temp + 512);
cr_data = XGI_CRT1Table[index].CR[11];
/* Vertical retrace (=sync) end */
VRE = (cr_data & 0x0f) | ((sr_data & 0x20) >> 1);
- temp = VRE - ((E + F - 1) & 31);
+ temp = VRE - ((VDE + F - 1) & 31);
C = (temp > 0) ? temp : (temp + 32);
D = B - F - C;
--
1.7.8.6
next prev parent reply other threads:[~2013-02-03 21:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-03 21:54 [PATCH 01/10] staging/xgifb: Simplify XGI_GetRatePtrCRT2 Peter Huewe
2013-02-03 21:54 ` [PATCH 02/10] staging/xgifb: Remove always false comparisons Peter Huewe
2013-02-03 21:54 ` [PATCH 03/10] staging/xgifb: mttr must be (signed) int Peter Huewe
2013-02-03 21:54 ` [PATCH 04/10] staging/xgifb: Fix return of uninitialized variable Peter Huewe
2013-02-03 21:54 ` [PATCH 05/10] staging/xgifb: Simplify XGI_SetSeqRegs Peter Huewe
2013-02-03 21:54 ` [PATCH 06/10] staging/xgifb: rewrite XGIfb_get_cmap_len Peter Huewe
2013-02-03 21:54 ` Peter Huewe [this message]
2013-02-03 21:54 ` [PATCH 08/10] staging/xgifb: Remove unnecessary bitshifts in XGI_SetCRT1ModeRegs Peter Huewe
2013-02-04 12:59 ` Dan Carpenter
2013-02-04 18:25 ` H Hartley Sweeten
2013-02-03 21:54 ` [PATCH 09/10] staging/xgifb: Consolidate XGI_EnableChISLCD and XGI_DisableChISLCD Peter Huewe
2013-02-03 21:54 ` [PATCH 10/10] staging/xgifb: Simplify XGISetModeNew Peter Huewe
2013-02-04 19:37 ` [PATCH 01/10] staging/xgifb: Simplify XGI_GetRatePtrCRT2 Aaro Koskinen
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=1359928479-8484-7-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 \
--cc=solid.se7en@gmail.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;
as well as URLs for NNTP newsgroup(s).