* [PATCH 17/19] Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs().
2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
@ 2012-07-05 14:46 ` Miguel Gómez
0 siblings, 0 replies; 4+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:46 UTC (permalink / raw)
To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
Cc: devel, linux-kernel, Miguel Gómez
Rework some conditions to reduce indentation and fix style warnings.
Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
drivers/staging/xgifb/vb_setmode.c | 81 ++++++++++++++++--------------------
1 file changed, 36 insertions(+), 45 deletions(-)
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index 3e0d668..f41e595 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -5993,59 +5993,50 @@ static void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
tempah = 0x08;
tempbl = 0xf0;
- if (pVBInfo->VBInfo & DisableCRT2Display) {
- xgifb_reg_and_or(pVBInfo->Part1Port, 0x2e, tempbl, tempah);
- } else {
+ do {
+ if (pVBInfo->VBInfo & DisableCRT2Display)
+ break;
+
tempah = 0x00;
tempbl = 0xff;
- if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV
- | SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) {
- if ((pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) &&
- (!(pVBInfo->VBInfo & SetSimuScanMode))) {
- tempbl &= 0xf7;
- tempah |= 0x01;
- xgifb_reg_and_or(pVBInfo->Part1Port, 0x2e,
- tempbl, tempah);
- } else {
- if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
- tempbl &= 0xf7;
- tempah |= 0x01;
- }
+ if (!(pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV |
+ SetCRT2ToLCD | XGI_SetCRT2ToLCDA)))
+ break;
- if (pVBInfo->VBInfo &
- (SetCRT2ToRAMDAC |
- SetCRT2ToTV |
- SetCRT2ToLCD)) {
- tempbl &= 0xf8;
- tempah = 0x01;
+ if ((pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) &&
+ (!(pVBInfo->VBInfo & SetSimuScanMode))) {
+ tempbl &= 0xf7;
+ tempah |= 0x01;
+ break;
+ }
- if (!(pVBInfo->VBInfo & SetInSlaveMode))
- tempah |= 0x02;
+ if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
+ tempbl &= 0xf7;
+ tempah |= 0x01;
+ }
- if (!(pVBInfo->VBInfo &
- SetCRT2ToRAMDAC)) {
- tempah = tempah ^ 0x05;
- if (!(pVBInfo->VBInfo &
- SetCRT2ToLCD))
- tempah = tempah ^ 0x01;
- }
+ if (!(pVBInfo->VBInfo &
+ (SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD)))
+ break;
- if (!(pVBInfo->VBInfo &
- SetCRT2ToDualEdge))
- tempah |= 0x08;
- xgifb_reg_and_or(pVBInfo->Part1Port,
- 0x2e, tempbl, tempah);
- } else {
- xgifb_reg_and_or(pVBInfo->Part1Port,
- 0x2e, tempbl, tempah);
- }
- }
- } else {
- xgifb_reg_and_or(pVBInfo->Part1Port, 0x2e, tempbl,
- tempah);
+ tempbl &= 0xf8;
+ tempah = 0x01;
+
+ if (!(pVBInfo->VBInfo & SetInSlaveMode))
+ tempah |= 0x02;
+
+ if (!(pVBInfo->VBInfo & SetCRT2ToRAMDAC)) {
+ tempah = tempah ^ 0x05;
+ if (!(pVBInfo->VBInfo & SetCRT2ToLCD))
+ tempah = tempah ^ 0x01;
}
- }
+
+ if (!(pVBInfo->VBInfo & SetCRT2ToDualEdge))
+ tempah |= 0x08;
+
+ } while (0);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x2e, tempbl, tempah);
if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD
| XGI_SetCRT2ToLCDA)) {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 17/19] Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs().
@ 2012-07-06 6:56 Dan Carpenter
2012-07-06 8:16 ` Miguel Gómez
0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2012-07-06 6:56 UTC (permalink / raw)
To: Miguel Gómez
Cc: arnaud.patard, gregkh, aaro.koskinen, devel, linux-kernel
On Thu, Jul 05, 2012 at 04:46:00PM +0200, Miguel Gómez wrote:
> Rework some conditions to reduce indentation and fix style warnings.
>
Instead of a do { } while(0); it would be better to just use gotos.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 17/19] Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs().
2012-07-06 6:56 [PATCH 17/19] Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs() Dan Carpenter
@ 2012-07-06 8:16 ` Miguel Gómez
2012-07-06 8:21 ` Dan Carpenter
0 siblings, 1 reply; 4+ messages in thread
From: Miguel Gómez @ 2012-07-06 8:16 UTC (permalink / raw)
To: Dan Carpenter; +Cc: arnaud.patard, gregkh, aaro.koskinen, devel, linux-kernel
> On Thu, Jul 05, 2012 at 04:46:00PM +0200, Miguel Gómez wrote:
>> Rework some conditions to reduce indentation and fix style warnings.
>>
>
> Instead of a do { } while(0); it would be better to just use gotos.
Point taken. I used the do-while because I didn't want to abuse gotos,
but if there's no problem with them I'll change the patch.
I'll also change your comments in previous email about the comments ;)
Regards!
--
Miguel Gómez
Igalia - http://www.igalia.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 17/19] Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs().
2012-07-06 8:16 ` Miguel Gómez
@ 2012-07-06 8:21 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2012-07-06 8:21 UTC (permalink / raw)
To: Miguel Gómez
Cc: devel, gregkh, linux-kernel, arnaud.patard, aaro.koskinen
On Fri, Jul 06, 2012 at 10:16:36AM +0200, Miguel Gómez wrote:
> >On Thu, Jul 05, 2012 at 04:46:00PM +0200, Miguel Gómez wrote:
> >>Rework some conditions to reduce indentation and fix style warnings.
> >>
> >
> >Instead of a do { } while(0); it would be better to just use gotos.
>
> Point taken. I used the do-while because I didn't want to abuse
> gotos, but if there's no problem with them I'll change the patch.
>
That style of goto is fine/standard in the kernel.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-07-06 8:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-06 6:56 [PATCH 17/19] Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs() Dan Carpenter
2012-07-06 8:16 ` Miguel Gómez
2012-07-06 8:21 ` Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
2012-07-05 14:46 ` [PATCH 17/19] Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs() Miguel Gómez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox