aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-02-14 10:46:47 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2016-02-14 10:46:47 -0800
commitbe3f4e0fb3e1ba33c94c43c7cdab9e5165d508b4 (patch)
treebcc1da9a70d93c6bd3263cf22a68eeefd55facd7 /arch
parentMerge branch 'component' of git://ftp.arm.linux.org.uk/~rmk/linux-arm (diff)
parentARM: 8519/1: ICST: try other dividends than 1 (diff)
downloadlinux-dev-be3f4e0fb3e1ba33c94c43c7cdab9e5165d508b4.tar.xz
linux-dev-be3f4e0fb3e1ba33c94c43c7cdab9e5165d508b4.zip
Merge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm
Pull ARM fixes from Russell King: "A couple of ARM fixes from Linus for the ICST clock generator code" [ "Linus" here is Linus Walleij. Name-stealer. Linus "there can be only one" Torvalds ] * 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm: ARM: 8519/1: ICST: try other dividends than 1 ARM: 8517/1: ICST: avoid arithmetic overflow in icst_hz()
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/common/icst.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/arm/common/icst.c b/arch/arm/common/icst.c
index 2dc6da70ae59..d7ed252708c5 100644
--- a/arch/arm/common/icst.c
+++ b/arch/arm/common/icst.c
@@ -16,7 +16,7 @@
*/
#include <linux/module.h>
#include <linux/kernel.h>
-
+#include <asm/div64.h>
#include <asm/hardware/icst.h>
/*
@@ -29,7 +29,11 @@ EXPORT_SYMBOL(icst525_s2div);
unsigned long icst_hz(const struct icst_params *p, struct icst_vco vco)
{
- return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * p->s2div[vco.s]);
+ u64 dividend = p->ref * 2 * (u64)(vco.v + 8);
+ u32 divisor = (vco.r + 2) * p->s2div[vco.s];
+
+ do_div(dividend, divisor);
+ return (unsigned long)dividend;
}
EXPORT_SYMBOL(icst_hz);
@@ -58,6 +62,7 @@ icst_hz_to_vco(const struct icst_params *p, unsigned long freq)
if (f > p->vco_min && f <= p->vco_max)
break;
+ i++;
} while (i < 8);
if (i >= 8)