Skip to contentSkip to conversation

staging: skein: Fixed Conditional white space problems

PATCH In review Eric Rost 3 participants 5 messages Sep 28, 2014 – Sep 30, 2014 Staging

lore
Share & tools
lore

Eric Rost

author
#0 lore raw

PATCH 1/1 staging: skein: Fixed Conditional white space problems

This patch fixes the following checkpatch.pl Warnings:

WARNING: suspect code indent for conditional statements (16, 16)
+ for (r = 1; r < 2 * RCNT; r += 2 * SKEIN_UNROLL_512)
[...]
+ {

WARNING: suspect code indent for conditional statements (16, 16)
+ for (r = 1; r <= 2 * RCNT; r += 2 * SKEIN_UNROLL_1024)
[...]
+ {

---
 drivers/staging/skein/skein_block.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/skein/skein_block.c +4 -4
index 616364f..bbb5a5b 100644
@@ -380,7 +380,7 @@ do { \
 
 		for (r = 1; r < 2 * RCNT; r += 2 * SKEIN_UNROLL_512)
 #endif /* end of looped code definitions */
-		{
+			{
 #define R512_8_ROUNDS(R)  /* do 8 full rounds */  \
 do { \
 		R512(0, 1, 2, 3, 4, 5, 6, 7, R_512_0, 8 * (R) + 1);   \
@@ -447,7 +447,7 @@ do { \
 	#if  (SKEIN_UNROLL_512 > 14)
 #error  "need more unrolling in skein_512_process_block"
 	#endif
-		}
+			}
 
 		/* do the final "feedforward" xor, update context chaining */
 		ctx->x[0] = X0 ^ w[0];
@@ -659,7 +659,7 @@ do { \
 
 		for (r = 1; r <= 2 * RCNT; r += 2 * SKEIN_UNROLL_1024)
 #endif
-		{
+			{
 #define R1024_8_ROUNDS(R) \
 do { \
 	R1024(00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15, \
@@ -734,7 +734,7 @@ do { \
 #if  (SKEIN_UNROLL_1024 > 14)
 #error  "need more unrolling in Skein_1024_Process_Block"
   #endif
-		}
+			}
 		/* do the final "feedforward" xor, update context chaining */
 
 		ctx->x[0] = X00 ^ w[0];
Signature · 1 line
1.7.10.4
maintainer
#1 lore raw
Quoted 22 lines · Eric Rost

This patch fixes the following checkpatch.pl Warnings:

WARNING: suspect code indent for conditional statements (16, 16)

(quoted diff) +2 -0
+               for (r = 1; r < 2 * RCNT; r += 2 * SKEIN_UNROLL_512)
[...]
+               {

WARNING: suspect code indent for conditional statements (16, 16)

(quoted diff) +2 -0
+               for (r = 1; r <= 2 * RCNT; r += 2 * SKEIN_UNROLL_1024)
[...]
+               {
---
 drivers/staging/skein/skein_block.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/skein/skein_block.c +0 -0
index 616364f..bbb5a5b 100644

drivers/staging/skein/skein_block.c do { \ · line 383

Quoted 5 lines
drivers/staging/skein/skein_block.c +1 -1
@@ -380,7 +380,7 @@ do { \
 
 		for (r = 1; r < 2 * RCNT; r += 2 * SKEIN_UNROLL_512)
 #endif /* end of looped code definitions */
-		{
+			{

I'm glad you are trying to fix things, but in looking at this closer, does it look correct to you?

drivers/staging/skein/skein_block.c do { \ · line 450

Quoted 9 lines
drivers/staging/skein/skein_block.c +1 -1
 #define R512_8_ROUNDS(R)  /* do 8 full rounds */  \
 do { \
 		R512(0, 1, 2, 3, 4, 5, 6, 7, R_512_0, 8 * (R) + 1);   \
@@ -447,7 +447,7 @@ do { \
 	#if  (SKEIN_UNROLL_512 > 14)
 #error  "need more unrolling in skein_512_process_block"
 	#endif
-		}
+			}

same here?

How about working on getting rid of the #if crap in this driver, that will fix up this { } mess automatically.

thanks,

greg k-h

#2 lore raw
Quoted 2 lines · Greg KH

How about working on getting rid of the #if crap in this driver, that will fix up this { } mess automatically.

Yes, I commented on that earlier, it's a rather big job and may not be appropriate for a beginner.

Eric, if you'd like to tackle it, be aware that it's most likely going to be a series of changes, and I'll be looking to see that no object code has changed (./scripts/objdiff) across your patch series.

thx,

Jason.

author
#3 lore raw
Quoted 2 lines
Quoted 1 line

I'll be looking to see that no object

code has changed (./scripts/objdiff) across your patch series.

Hmm... I'm thinking of digging into it, but I'm not sure the #if's can be gotten rid of sans object code changes, since its picking codeblocks in the precompiler stage, right?

#4 lore raw

Eric,

Quoted 6 lines · Eric Rost
Quoted 2 lines
Quoted 1 line

I'll be looking to see that no object

code has changed (./scripts/objdiff) across your patch series.

Hmm... I'm thinking of digging into it, but I'm not sure the #if's can be gotten rid of sans object code changes, since its picking codeblocks in the precompiler stage, right?

You just have to remain consistent with what's currently being selected. But yes, you are correct.

And don't get yourself too tied up in knots wrt objdiff-perfection. I would take a look at what Joe Perches posted as a starting point. I haven't reviewed it in depth yet as I'm wrapped around the axle with other commitments.

If you get stuck, just ask. A *little* beating your head against the wall is part of the learning process, a lot is just unnecessary frustration.

wrt to this code, we don't necessarily need to see the macros and such removed. First step, get them out of the middle of functions. Second step, decide which would be better off as static inline functions. The rest may be able to go into a common include.

thx,

Jason.