mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC][PATCH] arch: arm [mach-imx] use sign_extend32() for sign_extension
@ 2015-02-19 12:08 Martin Kepplinger
  2015-02-19 12:08 ` [PATCH] " Martin Kepplinger
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Kepplinger @ 2015-02-19 12:08 UTC (permalink / raw)
  To: shawn.guo, kernel, linux; +Cc: linux-arm-kernel, linux-kernel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] arch: arm [mach-imx] use sign_extend32() for sign_extension
  2015-02-19 12:08 [RFC][PATCH] arch: arm [mach-imx] use sign_extend32() for sign_extension Martin Kepplinger
@ 2015-02-19 12:08 ` Martin Kepplinger
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Kepplinger @ 2015-02-19 12:08 UTC (permalink / raw)
  To: shawn.guo, kernel, linux
  Cc: linux-arm-kernel, linux-kernel, Martin Kepplinger, Martin Kepplinger

From: Martin Kepplinger <martin.kepplinger@theobroma-systems.com>

Signed-off-by: Martin Kepplinger <martink@posteo.de>
---
 arch/arm/mach-imx/clk-pllv2.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-imx/clk-pllv2.c b/arch/arm/mach-imx/clk-pllv2.c
index 20889d5..1bbd08c 100644
--- a/arch/arm/mach-imx/clk-pllv2.c
+++ b/arch/arm/mach-imx/clk-pllv2.c
@@ -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)
-- 
2.1.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-19 12:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-19 12:08 [RFC][PATCH] arch: arm [mach-imx] use sign_extend32() for sign_extension Martin Kepplinger
2015-02-19 12:08 ` [PATCH] " Martin Kepplinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®