diff options
Diffstat (limited to 'lib/lcm.c')
-rw-r--r-- | lib/lcm.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/lcm.c b/lib/lcm.c index 51cc6b13cd52..03d7fcb420b5 100644 --- a/lib/lcm.c +++ b/lib/lcm.c @@ -1,4 +1,4 @@ -#include <linux/kernel.h> +#include <linux/compiler.h> #include <linux/gcd.h> #include <linux/export.h> #include <linux/lcm.h> @@ -12,3 +12,14 @@ unsigned long lcm(unsigned long a, unsigned long b) return 0; } EXPORT_SYMBOL_GPL(lcm); + +unsigned long lcm_not_zero(unsigned long a, unsigned long b) +{ + unsigned long l = lcm(a, b); + + if (l) + return l; + + return (b ? : a); +} +EXPORT_SYMBOL_GPL(lcm_not_zero); |