Skip to contentSkip to conversation

arch: arm [mach-imx] use sign_extend32() for sign_extension

RFC PATCH New Martin Kepplinger 1 participant 2 messages Feb 19, 2015

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

RFC PATCH 1/1 arch: arm [mach-imx] use sign_extend32() for sign_extension

I didn't build the following change. It should be correct though. If you can add it to a tree and build or even run it before offering it for-linus, feel free to do so. Otherwise please ignore.

thanks,
martin

#1 lore raw

PATCH 1/1 arch: arm [mach-imx] use sign_extend32() for sign_extension

From: Martin Kepplinger <[email protected]>

---
 arch/arm/mach-imx/clk-pllv2.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/mach-imx/clk-pllv2.c +4 -4
index 20889d5..1bbd08c 100644
@@ -5,6 +5,7 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/err.h>
+#include <linux/bitops.h>
 
 #include <asm/div64.h>
 
@@ -88,11 +89,10 @@ static unsigned long __clk_pllv2_recalc_rate(unsigned long parent_rate,
 	mfi = (mfi <= 5) ? 5 : mfi;
 	mfd = dp_mfd & MXC_PLL_DP_MFD_MASK;
 	mfn = mfn_abs = dp_mfn & MXC_PLL_DP_MFN_MASK;
-	/* Sign extend to 32-bits */
-	if (mfn >= 0x04000000) {
-		mfn |= 0xFC000000;
+
+	mfn = sign_extend32(mfn, 26);
+	if (mfn < 0)
 		mfn_abs = -mfn;
-	}
 
 	ref_clk = 2 * parent_rate;
 	if (dbl != 0)
Signature · 1 line
2.1.4