Skip to contentSkip to conversation

staging: sm750fb: ddk750_chip.c: Prefer using the BIT macro

PATCH Superseded Sanjana Sanikommu 2 participants 3 messages Mar 25, 2019

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: sm750fb: ddk750_chip.c: Prefer using the BIT macro

Challenge suggested by coccinelle.

Replace bit shifting on 1 with the BIT(x) macro.
Coccinelle script:

@@
constant c;
@@

-(1 << c)
+BIT(c)

---
Changes in v2:
Modify script to remove parentheses around BIT.

 drivers/staging/sm750fb/ddk750_chip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/sm750fb/ddk750_chip.c +1 -1
index 4c1f00f551da..eea4c08b8a26 100644
@@ -45,7 +45,7 @@ static unsigned int get_mxclk_freq(void)
 	OD = (pll_reg & PLL_CTRL_OD_MASK) >> PLL_CTRL_OD_SHIFT;
 	POD = (pll_reg & PLL_CTRL_POD_MASK) >> PLL_CTRL_POD_SHIFT;
 
-	return DEFAULT_INPUT_CLOCK * M / N / (1 << OD) / (1 << POD);
+	return DEFAULT_INPUT_CLOCK * M / N / BIT(OD) / BIT(POD);
 }
 
 /*
Signature · 1 line
2.17.1
#1 lore raw

The subject line should follow what is mostly done for this driver, which is staging: sm750fb:.

julia

Quoted 42 lines · Sanjana Sanikommu

Challenge suggested by coccinelle.

Replace bit shifting on 1 with the BIT(x) macro.
Coccinelle script:

@@
constant c;
@@

(quoted diff) +1 -1
-(1 << c)
+BIT(c)

---
Changes in v2:
Modify script to remove parentheses around BIT.

 drivers/staging/sm750fb/ddk750_chip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/sm750fb/ddk750_chip.c +1 -2
index 4c1f00f551da..eea4c08b8a26 100644
@@ -45,7 +45,7 @@ static unsigned int get_mxclk_freq(void)
 	OD = (pll_reg & PLL_CTRL_OD_MASK) >> PLL_CTRL_OD_SHIFT;
 	POD = (pll_reg & PLL_CTRL_POD_MASK) >> PLL_CTRL_POD_SHIFT;
 
-	return DEFAULT_INPUT_CLOCK * M / N / (1 << OD) / (1 << POD);
+	return DEFAULT_INPUT_CLOCK * M / N / BIT(OD) / BIT(POD);
 }
 
 /*
--

2.17.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/20190325072538.6809-1-sanjana99reddy99%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 4 lines · Julia Lawall

The subject line should follow what is mostly done for this driver, which is staging: sm750fb:.

Sure, I would change the subject line
Sanjana.

Quoted 54 lines

julia

Quoted 12 lines · Sanjana Sanikommu

Challenge suggested by coccinelle.

Replace bit shifting on 1 with the BIT(x) macro.
Coccinelle script:

@@
constant c;
@@

(quoted diff) +1 -1
-(1 << c) 
+BIT(c) 

Review

Quoted 8 lines
Signed-off-by Sanjana Sanikommu <[email protected] <javascript:>>

---
Changes in v2:
Modify script to remove parentheses around BIT.

 drivers/staging/sm750fb/ddk750_chip.c | 2 +- 
 1 file changed, 1 insertion(+), 1 deletion(-) 
(quoted diff) +0 -0

b/drivers/staging/sm750fb/ddk750_chip.c

Quoted 17 lines

index 4c1f00f551da..eea4c08b8a26 100644

drivers/staging/sm750fb/ddk750_chip.c +1 -1
@@ -45,7 +45,7 @@ static unsigned int get_mxclk_freq(void) 
         OD = (pll_reg & PLL_CTRL_OD_MASK) >> PLL_CTRL_OD_SHIFT; 
         POD = (pll_reg & PLL_CTRL_POD_MASK) >> PLL_CTRL_POD_SHIFT; 
 
-        return DEFAULT_INPUT_CLOCK * M / N / (1 << OD) / (1 << POD); 
+        return DEFAULT_INPUT_CLOCK * M / N / BIT(OD) / BIT(POD); 
 } 
 
 /* 
Signature · 4 lines
2.17.1 

-- 
You received this message because you are subscribed to the Google 

Groups "outreachy-kernel" group.

Quoted 1 line

To unsubscribe from this group and stop receiving emails from it, send

an email to [email protected] <javascript:>.

Quoted 1 line

To post to this group, send email to [email protected]

<javascript:>.

Quoted 1 line

To view this discussion on the web visit

https://groups.google.com/d/msgid/outreachy-kernel/20190325072538.6809-1-sanjana99reddy99%40gmail.com.

Quoted 2 lines

For more options, visit https://groups.google.com/d/optout.