Skip to contentSkip to conversation

Staging: sm750fb: Insert spaces in for statement

PATCH In review Amitoj Kaur Chawla 2 participants 4 messages Mar 29, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 4/4 Staging: sm750fb: Insert spaces in for statement

Insert required spaces in for statements after operators and ';'. Problem found using checkpatch.pl
ERROR: spaces required around that '=' (ctx:VxV)

---
 drivers/staging/sm750fb/ddk750_chip.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/sm750fb/ddk750_chip.c +6 -6
index 5f2f424..e11b8c5 100644
@@ -41,7 +41,7 @@ inline unsigned int twoToPowerOfx(unsigned long x)
 	unsigned long i;
 	unsigned long result = 1;
 
-	for (i=1; i<=x; i++)
+	for ( i = 1; i <= x; i++)
 		result *= 2;
 	return result;
 }
@@ -455,7 +455,7 @@ unsigned int calcPllValue(unsigned int request_orig,pll_value_t *pll)
 	}
 
 
-	for(N = 15;N>1;N--)
+	for( N = 15; N > 1; N--)
 	{
 		/* RN will not exceed maximum long if @request <= 285 MHZ (for 32bit cpu) */
 		RN = N * request;
@@ -463,7 +463,7 @@ unsigned int calcPllValue(unsigned int request_orig,pll_value_t *pll)
 		rem = RN % input;/* rem always small than 14318181 */
 		fl_quo = (rem * 10000 /input);
 
-		for(d = xcnt - 1;d >= 0;d--){
+		for(d = xcnt - 1; d >= 0; d--){
 			X = xparm[d].value;
 			M = quo*X;
 			M += fl_quo * X / 10000;
@@ -511,7 +511,7 @@ pll_value_t *pPLL           /* Structure to hold the value to be set in PLL */
 
 #ifndef VALIDATION_CHIP
     /* The maximum of post divider is 8. */
-	for (POD=0; POD<=3; POD++)
+	for (POD = 0; POD <= 3; POD++)
 #endif
 		{
 
@@ -525,7 +525,7 @@ pll_value_t *pPLL           /* Structure to hold the value to be set in PLL */
 	podPower = twoToPowerOfx(POD);
 
 	/* OD has only 2 bits [15:14] and its value must between 0 to 3 */
-	for (OD=0; OD<=3; OD++) {
+	for (OD = 0; OD <= 3; OD++) {
 		/* Work out 2 to the power of OD */
 		odPower = twoToPowerOfx(OD);
 
@@ -538,7 +538,7 @@ pll_value_t *pPLL           /* Structure to hold the value to be set in PLL */
 
 		/* N has 4 bits [11:8] and its value must between 2 and 15.
 		The N == 1 will behave differently --> Result is not correct. */
-	for (N=2; N<=15; N++) {
+	for (N = 2; N <= 15; N++) {
 		/* The formula for PLL is ulRequestClk = inputFreq * M / N / (2^OD)
 		In the following steps, we try to work out a best M value given the others are known.
 		To avoid decimal calculation, we use 1000 as multiplier for up to 3 decimal places of accuracy.
Signature · 1 line
1.9.1
#1 lore raw
Quoted 14 lines · Amitoj Kaur Chawla

Insert required spaces in for statements after operators and ';'. Problem found using checkpatch.pl
ERROR: spaces required around that '=' (ctx:VxV)

---
 drivers/staging/sm750fb/ddk750_chip.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/sm750fb/ddk750_chip.c +0 -0
index 5f2f424..e11b8c5 100644

drivers/staging/sm750fb/ddk750_chip.c inline unsigned int twoToPowerOfx(unsigned long x) · line 44

Quoted 5 lines
drivers/staging/sm750fb/ddk750_chip.c +1 -1
@@ -41,7 +41,7 @@ inline unsigned int twoToPowerOfx(unsigned long x)
 	unsigned long i;
 	unsigned long result = 1;
 
-	for (i=1; i<=x; i++)
+	for ( i = 1; i <= x; i++)

There should be no space after the (. Checkpatch should have complained about that.

julia

Quoted 58 lines
drivers/staging/sm750fb/ddk750_chip.c +5 -6
 		result *= 2;
 	return result;
 }
@@ -455,7 +455,7 @@ unsigned int calcPllValue(unsigned int request_orig,pll_value_t *pll)
 	}
 
 
-	for(N = 15;N>1;N--)
+	for( N = 15; N > 1; N--)
 	{
 		/* RN will not exceed maximum long if @request <= 285 MHZ (for 32bit cpu) */
 		RN = N * request;
@@ -463,7 +463,7 @@ unsigned int calcPllValue(unsigned int request_orig,pll_value_t *pll)
 		rem = RN % input;/* rem always small than 14318181 */
 		fl_quo = (rem * 10000 /input);
 
-		for(d = xcnt - 1;d >= 0;d--){
+		for(d = xcnt - 1; d >= 0; d--){
 			X = xparm[d].value;
 			M = quo*X;
 			M += fl_quo * X / 10000;
@@ -511,7 +511,7 @@ pll_value_t *pPLL           /* Structure to hold the value to be set in PLL */
 
 #ifndef VALIDATION_CHIP
     /* The maximum of post divider is 8. */
-	for (POD=0; POD<=3; POD++)
+	for (POD = 0; POD <= 3; POD++)
 #endif
 		{
 
@@ -525,7 +525,7 @@ pll_value_t *pPLL           /* Structure to hold the value to be set in PLL */
 	podPower = twoToPowerOfx(POD);
 
 	/* OD has only 2 bits [15:14] and its value must between 0 to 3 */
-	for (OD=0; OD<=3; OD++) {
+	for (OD = 0; OD <= 3; OD++) {
 		/* Work out 2 to the power of OD */
 		odPower = twoToPowerOfx(OD);
 
@@ -538,7 +538,7 @@ pll_value_t *pPLL           /* Structure to hold the value to be set in PLL */
 
 		/* N has 4 bits [11:8] and its value must between 2 and 15.
 		The N == 1 will behave differently --> Result is not correct. */
-	for (N=2; N<=15; N++) {
+	for (N = 2; N <= 15; N++) {
 		/* The formula for PLL is ulRequestClk = inputFreq * M / N / (2^OD)
 		In the following steps, we try to work out a best M value given the others are known.
 		To avoid decimal calculation, we use 1000 as multiplier for up to 3 decimal places of accuracy.
--

1.9.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20150329091836.GA19941%40amitoj-Inspiron-3542.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 20 lines · Julia Lawall

Review

Quoted 10 lines · Amitoj Kaur Chawla

Insert required spaces in for statements after operators and ';'. Problem found using checkpatch.pl
ERROR: spaces required around that '=' (ctx:VxV)

---
 drivers/staging/sm750fb/ddk750_chip.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/sm750fb/ddk750_chip.c

Quoted 7 lines

index 5f2f424..e11b8c5 100644

drivers/staging/sm750fb/ddk750_chip.c +0 -0
@@ -41,7 +41,7 @@ inline unsigned int twoToPowerOfx(unsigned long x)
      unsigned long i;
      unsigned long result = 1;
 
Quoted 9 lines

drivers/staging/sm750fb/ddk750_chip.c inline unsigned int twoToPowerOfx(unsigned long x) · line 44

Quoted 2 lines
drivers/staging/sm750fb/ddk750_chip.c +1 -1
-     for (i=1; i<=x; i++)
+     for ( i = 1; i <= x; i++)

There should be no space after the (. Checkpatch should have complained about that.

julia

The space after ( is a frequent error in the file so I thought I could send a different patch for that, after fixing all of them. Or would you prefer me to send a second version of this patch with only this correction?

Signature · 4 lines
*Regards,*


*Amitoj Kaur Chawla*
#3 lore raw
Quoted 35 lines · Amitoj Kaur Chawla

On Sun, Mar 29, 2015 at 2:58 PM, Julia Lawall <[email protected]> wrote:

      On Sun, 29 Mar 2015, Amitoj Kaur Chawla wrote:

      > Insert required spaces in for statements after operators and
      ';'.
      > Problem found using checkpatch.pl
      > ERROR: spaces required around that '=' (ctx:VxV)
      >
      > Signed-off-by: Amitoj Kaur Chawla <[email protected]>
      > ---
      >  drivers/staging/sm750fb/ddk750_chip.c | 12 ++++++------
      >  1 file changed, 6 insertions(+), 6 deletions(-)
      >
      > diff --git a/drivers/staging/sm750fb/ddk750_chip.c
      b/drivers/staging/sm750fb/ddk750_chip.c
      > index 5f2f424..e11b8c5 100644
      > --- a/drivers/staging/sm750fb/ddk750_chip.c
      > +++ b/drivers/staging/sm750fb/ddk750_chip.c
      > @@ -41,7 +41,7 @@ inline unsigned int twoToPowerOfx(unsigned
      long x)
      >       unsigned long i;
      >       unsigned long result = 1;
      >
      > -     for (i=1; i<=x; i++)
      > +     for ( i = 1; i <= x; i++)

      There should be no space after the (.  Checkpatch should have
      complained
      about that.

      julia
Quoted 3 lines

The space after ( is a frequent error in the file so I thought I could send a different patch for that, after fixing all of them. Or would you prefer me to send a second version of this patch with only this correction?

In general, you should not intrduce new checkpatch warnings. There was no space after the ( in the original code, so it doesn't make much sense to introduce bad code even if it is like other bad code in the file. It would be better to redo this patch series such that you don't introduce any checkpatch warnings. At the same time, you could add another patch to the series to fix the "( "s in this file.

julia