* 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
* [PATCH 00/19] Several cleanings and style fixes
@ 2012-07-05 14:45 Miguel Gómez
2012-07-05 14:46 ` [PATCH 17/19] Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs() Miguel Gómez
0 siblings, 1 reply; 4+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:45 UTC (permalink / raw)
To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
Cc: devel, linux-kernel, Miguel Gómez
Hi!
The goal of this round of patches is to perform a cleaning of the code and
to remove the style problems found on it.
The first patch removes a lot of comments and commented code, leaving only
those that seem interesting to understand the code.
Then there are some patches removing useless structures and pieces of code
that I found during the comment revision.
And also a patch improving some debug strings that I had pending from my
previous round of patches.
Patches 10 to 17 rework some conditions in some places of the code to fix
style errors related to excessive indentation. And patch 18 fixes the remaining
style errors.
Finally patch 19 removes a useless condition.
After this round of pathches, there are no style errors in the code that
are reported by checkpatch.
Regards!
Miguel Gómez (19):
Staging: xgifb: Comment cleaning.
Staging: xgifb: Remove unneeded XGI_LCD_TYPE enumeration.
Staging: xgifb: Remove LCDA detection in xgifb_probe().
Staging: xgifb: Remove unused struct _chswtable.
Staging: xgifb: Improve debug strings.
Staging: xgifb: Remove useless switch in XGIfb_detect_VB().
Staging: xgifb: Simplify XGIfb_GetXG21DefaultLVDSModeIdx().
Staging: xgifb: Remove unneeded var and condition in
XGIfb_search_vesamode().
Staging: xgifb: Remove useless always true condition.
Staging: xgifb: Rework conditions in XGI_SetATTRegs().
Staging: xgifb: Refactor XGI_AjustCRT2Rate().
Staging: xgifb: Refactor XGI_GetVBType().
Staging: xgifb: Rework conditions in XGI_GetVBInfo().
Staging: xgifb: Refactor XGI_GetCRT2ResInfo().
Staging: xgifb: Rework conditions in XGI_SetLockRegs().
Staging: xgifb: Rework conditions in XGI_EnableBridge().
Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs().
Staging: xgifb: Fix coding style.
Staging: xgifb: Remove useless condition.
drivers/staging/xgifb/XGI_main.h | 14 -
drivers/staging/xgifb/XGI_main_26.c | 245 ++----------
drivers/staging/xgifb/XGIfb.h | 8 +-
drivers/staging/xgifb/vb_def.h | 3 -
drivers/staging/xgifb/vb_init.c | 166 +-------
drivers/staging/xgifb/vb_init.h | 1 -
drivers/staging/xgifb/vb_setmode.c | 742 ++++++++++++++++-------------------
drivers/staging/xgifb/vb_struct.h | 3 -
drivers/staging/xgifb/vb_table.h | 55 +--
drivers/staging/xgifb/vb_util.h | 1 -
drivers/staging/xgifb/vgatypes.h | 37 --
11 files changed, 437 insertions(+), 838 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 4+ messages in thread* [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
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