* [PATCH 1/5] staging/xgifb: Consolidate if/else if with identical code branches
@ 2013-02-15 19:37 Peter Huewe
2013-02-15 19:37 ` [PATCH 2/5] staging/xgifb: Remove unnecessary casts Peter Huewe
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Peter Huewe @ 2013-02-15 19:37 UTC (permalink / raw)
To: Arnaud Patard
Cc: Greg Kroah-Hartman, Aaro Koskinen, Peter Huewe,
Miguel Gómez, devel, linux-kernel
Both branches of this if statement execute the same code.
Thus we can || them together and remove code duplication
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
drivers/staging/xgifb/vb_setmode.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index 3d5c424..0b134af 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -5572,13 +5572,10 @@ static void XGI_EnableBridge(struct xgifb_video_info *xgifb_info,
if (pVBInfo->VBType & (VB_SIS301B | VB_SIS302B | VB_SIS301LV
| VB_SIS302LV | VB_XGI301C)) {
if (!(pVBInfo->SetFlag & DisableChA)) {
- if (pVBInfo->SetFlag & EnableChA) {
+ if ((pVBInfo->SetFlag & EnableChA) ||
+ (pVBInfo->VBInfo & SetCRT2ToDualEdge)) {
/* Power on */
xgifb_reg_set(pVBInfo->Part1Port, 0x1E, 0x20);
- } else if (pVBInfo->VBInfo & SetCRT2ToDualEdge) {
- /* Power on */
- xgifb_reg_set(pVBInfo->Part1Port,
- 0x1E, 0x20);
}
}
--
1.7.8.6
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/5] staging/xgifb: Remove unnecessary casts
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 ` Peter Huewe
2013-02-15 19:37 ` [PATCH 3/5] staging/xgifb: Remove code without effect Peter Huewe
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Peter Huewe @ 2013-02-15 19:37 UTC (permalink / raw)
To: Arnaud Patard
Cc: Greg Kroah-Hartman, Aaro Koskinen, Peter Huewe,
Miguel Gómez, devel, linux-kernel
Both functions xgifb_reg_get and inb return an u8 value, so we don't
need to cast their return value to unsigned char.
-> remove the cast
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
drivers/staging/xgifb/vb_init.c | 2 +-
drivers/staging/xgifb/vb_setmode.c | 66 +++++++++++++++++-------------------
2 files changed, 32 insertions(+), 36 deletions(-)
diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c
index 82170d4..df127e4 100644
--- a/drivers/staging/xgifb/vb_init.c
+++ b/drivers/staging/xgifb/vb_init.c
@@ -1341,7 +1341,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
xgifb_reg_and_or(pVBInfo->Part0Port, 0x3F, 0xEF, 0x00);
xgifb_reg_set(pVBInfo->Part1Port, 0x00, 0x00);
/* chk if BCLK>=100MHz */
- temp1 = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x7B);
+ temp1 = xgifb_reg_get(pVBInfo->P3d4, 0x7B);
temp = (unsigned char) ((temp1 >> 4) & 0x0F);
xgifb_reg_set(pVBInfo->Part1Port,
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index 0b134af..f5a9bb2 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -82,7 +82,7 @@ static void XGI_SetCRTCRegs(struct xgi_hw_device_info *HwDeviceExtension,
unsigned char CRTCdata;
unsigned short i;
- CRTCdata = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11);
+ CRTCdata = xgifb_reg_get(pVBInfo->P3d4, 0x11);
CRTCdata &= 0x7f;
xgifb_reg_set(pVBInfo->P3d4, 0x11, CRTCdata); /* Unlock CRTC */
@@ -139,7 +139,7 @@ static void XGI_SetGRCRegs(struct vb_device_info *pVBInfo)
}
if (pVBInfo->ModeType > ModeVGA) {
- GRdata = (unsigned char) xgifb_reg_get(pVBInfo->P3ce, 0x05);
+ GRdata = xgifb_reg_get(pVBInfo->P3ce, 0x05);
GRdata &= 0xBF; /* 256 color disable */
xgifb_reg_set(pVBInfo->P3ce, 0x05, GRdata);
}
@@ -287,7 +287,7 @@ static void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo,
unsigned short i, j;
/* unlock cr0-7 */
- data = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11);
+ data = xgifb_reg_get(pVBInfo->P3d4, 0x11);
data &= 0x7F;
xgifb_reg_set(pVBInfo->P3d4, 0x11, data);
@@ -304,7 +304,7 @@ static void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo,
xgifb_reg_set(pVBInfo->P3c4, (unsigned short) (i + 6), data);
}
- j = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x0e);
+ j = xgifb_reg_get(pVBInfo->P3c4, 0x0e);
j &= 0x1F;
data = pVBInfo->TimingH.data[7];
data &= 0xE0;
@@ -312,17 +312,16 @@ static void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo,
xgifb_reg_set(pVBInfo->P3c4, 0x0e, data);
if (HwDeviceExtension->jChipType >= XG20) {
- data = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x04);
+ data = xgifb_reg_get(pVBInfo->P3d4, 0x04);
data = data - 1;
xgifb_reg_set(pVBInfo->P3d4, 0x04, data);
- data = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x05);
+ data = xgifb_reg_get(pVBInfo->P3d4, 0x05);
data1 = data;
data1 &= 0xE0;
data &= 0x1F;
if (data == 0) {
pushax = data;
- data = (unsigned char) xgifb_reg_get(pVBInfo->P3c4,
- 0x0c);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x0c);
data &= 0xFB;
xgifb_reg_set(pVBInfo->P3c4, 0x0c, data);
data = pushax;
@@ -330,7 +329,7 @@ static void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo,
data = data - 1;
data |= data1;
xgifb_reg_set(pVBInfo->P3d4, 0x05, data);
- data = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x0e);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x0e);
data = data >> 5;
data = data + 3;
if (data > 7)
@@ -362,7 +361,7 @@ static void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex,
xgifb_reg_set(pVBInfo->P3d4, (unsigned short) (i + 0x11), data);
}
- j = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x0a);
+ j = xgifb_reg_get(pVBInfo->P3c4, 0x0a);
j &= 0xC0;
data = pVBInfo->TimingV.data[6];
data &= 0x3F;
@@ -378,7 +377,7 @@ static void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex,
if (i)
data |= 0x80;
- j = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x09);
+ j = xgifb_reg_get(pVBInfo->P3d4, 0x09);
j &= 0x5F;
data |= j;
xgifb_reg_set(pVBInfo->P3d4, 0x09, data);
@@ -396,7 +395,7 @@ static void XGI_SetCRT1CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
index = XGI330_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
index = index & IndexMask;
- data = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11);
+ data = xgifb_reg_get(pVBInfo->P3d4, 0x11);
data &= 0x7F;
xgifb_reg_set(pVBInfo->P3d4, 0x11, data); /* Unlock CRTC */
@@ -741,8 +740,8 @@ static void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension,
tempax -= 1;
tempbx -= 1;
tempcx = tempax;
- temp = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11);
- data = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11);
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x11);
+ data = xgifb_reg_get(pVBInfo->P3d4, 0x11);
data &= 0x7F;
xgifb_reg_set(pVBInfo->P3d4, 0x11, data); /* Unlock CRTC */
xgifb_reg_set(pVBInfo->P3d4, 0x01, (unsigned short) (tempcx & 0xff));
@@ -759,7 +758,7 @@ static void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension,
tempax |= 0x40;
xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x42, tempax);
- data = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x07);
+ data = xgifb_reg_get(pVBInfo->P3d4, 0x07);
data &= 0xFF;
tempax = 0;
@@ -1779,7 +1778,7 @@ static unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex,
}
} /* {End of VB} */
- tempal = (unsigned char) inb((pVBInfo->P3ca + 0x02));
+ tempal = inb((pVBInfo->P3ca + 0x02));
tempal = tempal >> 2;
tempal &= 0x03;
@@ -3796,8 +3795,7 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
}
if (pVBInfo->TVInfo & TVSetPALM) {
- tempax = (unsigned char) xgifb_reg_get(pVBInfo->Part2Port,
- 0x01);
+ tempax = xgifb_reg_get(pVBInfo->Part2Port, 0x01);
tempax--;
xgifb_reg_and(pVBInfo->Part2Port, 0x01, tempax);
@@ -4405,7 +4403,7 @@ static void xgifb_set_lvds(struct xgifb_video_info *xgifb_info,
temp = (unsigned char) ((xgifb_info->lvds_data.LVDS_Capability &
(LCDPolarity << 8)) >> 8);
temp &= LCDPolarity;
- Miscdata = (unsigned char) inb(pVBInfo->P3cc);
+ Miscdata = inb(pVBInfo->P3cc);
outb((Miscdata & 0x3F) | temp, pVBInfo->P3c2);
@@ -4465,7 +4463,7 @@ static void xgifb_set_lvds(struct xgifb_video_info *xgifb_info,
LVDSVBE = LVDSVBS + LVDSVT - xgifb_info->lvds_data.LVDSVDE;
- temp = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11);
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x11);
xgifb_reg_set(pVBInfo->P3d4, 0x11, temp & 0x7f); /* Unlock CRTC */
if (!(modeflag & Charx8Dot))
@@ -5482,25 +5480,25 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
/* to fix XG42 single LCD sense to CRT+LCD */
xgifb_reg_set(pVBInfo->P3d4, 0x57, 0x4A);
- xgifb_reg_set(pVBInfo->P3d4, 0x53, (unsigned char) (xgifb_reg_get(
+ xgifb_reg_set(pVBInfo->P3d4, 0x53, (xgifb_reg_get(
pVBInfo->P3d4, 0x53) | 0x02));
- SR31 = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x31);
- CR63 = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x63);
- SR01 = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x01);
+ SR31 = xgifb_reg_get(pVBInfo->P3c4, 0x31);
+ CR63 = xgifb_reg_get(pVBInfo->P3d4, 0x63);
+ SR01 = xgifb_reg_get(pVBInfo->P3c4, 0x01);
xgifb_reg_set(pVBInfo->P3c4, 0x01, (unsigned char) (SR01 & 0xDF));
xgifb_reg_set(pVBInfo->P3d4, 0x63, (unsigned char) (CR63 & 0xBF));
- CR17 = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x17);
+ CR17 = xgifb_reg_get(pVBInfo->P3d4, 0x17);
xgifb_reg_set(pVBInfo->P3d4, 0x17, (unsigned char) (CR17 | 0x80));
- SR1F = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x1F);
+ SR1F = xgifb_reg_get(pVBInfo->P3c4, 0x1F);
xgifb_reg_set(pVBInfo->P3c4, 0x1F, (unsigned char) (SR1F | 0x04));
- SR07 = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x07);
+ SR07 = xgifb_reg_get(pVBInfo->P3c4, 0x07);
xgifb_reg_set(pVBInfo->P3c4, 0x07, (unsigned char) (SR07 & 0xFB));
- SR06 = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x06);
+ SR06 = xgifb_reg_get(pVBInfo->P3c4, 0x06);
xgifb_reg_set(pVBInfo->P3c4, 0x06, (unsigned char) (SR06 & 0xC3));
xgifb_reg_set(pVBInfo->P3d4, 0x11, 0x00);
@@ -5558,7 +5556,7 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
xgifb_reg_set(pVBInfo->P3d4, 0x63, CR63);
xgifb_reg_set(pVBInfo->P3c4, 0x31, SR31);
- xgifb_reg_set(pVBInfo->P3d4, 0x53, (unsigned char) (xgifb_reg_get(
+ xgifb_reg_set(pVBInfo->P3d4, 0x53, (xgifb_reg_get(
pVBInfo->P3d4, 0x53) & 0xFD));
xgifb_reg_set(pVBInfo->P3c4, 0x1F, (unsigned char) SR1F);
}
@@ -5583,8 +5581,7 @@ static void XGI_EnableBridge(struct xgifb_video_info *xgifb_info,
if ((pVBInfo->SetFlag & EnableChB) || (pVBInfo->VBInfo
& (SetCRT2ToLCD | SetCRT2ToTV
| SetCRT2ToRAMDAC))) {
- tempah = (unsigned char) xgifb_reg_get(
- pVBInfo->P3c4, 0x32);
+ tempah = xgifb_reg_get(pVBInfo->P3c4, 0x32);
tempah &= 0xDF;
if (pVBInfo->VBInfo & SetInSlaveMode) {
if (!(pVBInfo->VBInfo &
@@ -5594,8 +5591,8 @@ static void XGI_EnableBridge(struct xgifb_video_info *xgifb_info,
xgifb_reg_set(pVBInfo->P3c4, 0x32, tempah);
xgifb_reg_or(pVBInfo->P3c4, 0x1E, 0x20);
- tempah = (unsigned char) xgifb_reg_get(
- pVBInfo->Part1Port, 0x2E);
+ tempah = xgifb_reg_get(pVBInfo->Part1Port,
+ 0x2E);
if (!(tempah & 0x80))
xgifb_reg_or(pVBInfo->Part1Port,
@@ -5668,8 +5665,7 @@ static void XGI_EnableBridge(struct xgifb_video_info *xgifb_info,
/* enable CRT2 */
xgifb_reg_or(pVBInfo->Part1Port, 0x1E, 0x20);
- tempah = (unsigned char) xgifb_reg_get(pVBInfo->Part1Port,
- 0x2E);
+ tempah = xgifb_reg_get(pVBInfo->Part1Port, 0x2E);
if (!(tempah & 0x80))
xgifb_reg_or(pVBInfo->Part1Port, 0x2E, 0x80);
--
1.7.8.6
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/5] staging/xgifb: Remove code without effect
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 ` 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 ` [PATCH 5/5] staging/xgifb: Remove duplicated code in loops Peter Huewe
3 siblings, 1 reply; 7+ messages in thread
From: Peter Huewe @ 2013-02-15 19:37 UTC (permalink / raw)
To: Arnaud Patard
Cc: Greg Kroah-Hartman, Aaro Koskinen, Peter Huewe,
Miguel Gómez, devel, linux-kernel
The tempal variable is assigned and then immediately overwritten.
-> remove everything without effect.
The inb is kept for possible side effects.
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
drivers/staging/xgifb/vb_setmode.c | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index f5a9bb2..a602d43 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -1778,14 +1778,7 @@ static unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex,
}
} /* {End of VB} */
- tempal = inb((pVBInfo->P3ca + 0x02));
- tempal = tempal >> 2;
- tempal &= 0x03;
-
- /* for Dot8 Scaling LCD */
- if ((pVBInfo->LCDInfo & EnableScalingLCD) && (modeflag & Charx8Dot))
- tempal = tempal ^ tempal; /* ; set to VCLK25MHz always */
-
+ inb((pVBInfo->P3ca + 0x02));
tempal = XGI330_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
return tempal;
}
--
1.7.8.6
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/5] staging/xgifb: Consolidate return paths
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-15 19:37 ` Peter Huewe
2013-02-15 19:37 ` [PATCH 5/5] staging/xgifb: Remove duplicated code in loops Peter Huewe
3 siblings, 0 replies; 7+ messages in thread
From: Peter Huewe @ 2013-02-15 19:37 UTC (permalink / raw)
To: Arnaud Patard
Cc: Greg Kroah-Hartman, Aaro Koskinen, Peter Huewe,
Miguel Gómez, devel, linux-kernel
Both branches of this if statement end in the same return statement.
-> move the return to the bottom and get rid of the else statement.
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
drivers/staging/xgifb/vb_setmode.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index a602d43..edbe70b 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -2860,10 +2860,8 @@ static unsigned short XGI_GetOffset(unsigned short ModeNo,
temp = 0x6B;
if (infoflag & InterlaceMode)
temp = temp << 1;
- return temp * colordepth;
- } else {
- return temp * colordepth;
}
+ return temp * colordepth;
}
static void XGI_SetCRT2Offset(unsigned short ModeNo,
--
1.7.8.6
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/5] staging/xgifb: Remove duplicated code in loops.
2013-02-15 19:37 [PATCH 1/5] staging/xgifb: Consolidate if/else if with identical code branches Peter Huewe
` (2 preceding siblings ...)
2013-02-15 19:37 ` [PATCH 4/5] staging/xgifb: Consolidate return paths Peter Huewe
@ 2013-02-15 19:37 ` Peter Huewe
2013-02-18 11:18 ` Dan Carpenter
3 siblings, 1 reply; 7+ messages in thread
From: Peter Huewe @ 2013-02-15 19:37 UTC (permalink / raw)
To: Arnaud Patard
Cc: Greg Kroah-Hartman, Aaro Koskinen, Peter Huewe,
Miguel Gómez, devel, linux-kernel
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 5/5] staging/xgifb: Remove duplicated code in loops.
2013-02-15 19:37 ` [PATCH 5/5] staging/xgifb: Remove duplicated code in loops Peter Huewe
@ 2013-02-18 11:18 ` Dan Carpenter
0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2013-02-18 11:18 UTC (permalink / raw)
To: Peter Huewe
Cc: Arnaud Patard, devel, Aaro Koskinen, Greg Kroah-Hartman, linux-kernel
On Fri, Feb 15, 2013 at 08:37:13PM +0100, Peter Huewe wrote:
> - 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 */
The original code looks buggy, but it's been that way from the
initial commit so I have no idea what was intended. Perhaps the
"+ 1" was supposed to be a "+ i". There is no way to know really.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/5] staging/xgifb: Remove code without effect
2013-02-15 19:37 ` [PATCH 3/5] staging/xgifb: Remove code without effect Peter Huewe
@ 2013-02-18 11:25 ` Dan Carpenter
0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2013-02-18 11:25 UTC (permalink / raw)
To: Peter Huewe
Cc: Arnaud Patard, devel, Aaro Koskinen, Greg Kroah-Hartman, linux-kernel
On Fri, Feb 15, 2013 at 08:37:11PM +0100, Peter Huewe wrote:
> The tempal variable is assigned and then immediately overwritten.
> -> remove everything without effect.
>
> The inb is kept for possible side effects.
>
This was dead code after we removed old mode <= 14 support in
34c13ee2b "staging: xgifb: drop code for legacy VGA modes".
I don't know if the inb() is still needed. Aaro?
regards,
dan carpenter
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-02-18 11:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 5/5] staging/xgifb: Remove duplicated code in loops Peter Huewe
2013-02-18 11:18 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.