staging: sm750fb: replace absDiff with kernel standard abs macro
authorMike Rapoport <mike.rapoport@gmail.com>
Fri, 19 Feb 2016 15:56:13 +0000 (17:56 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Feb 2016 23:33:00 +0000 (15:33 -0800)
<linux/kernel.h> already has 'abs', use it instead of custom absDiff

Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/sm750fb/ddk750_chip.c
drivers/staging/sm750fb/sm750_help.h

index e53a3d1271ac4b199301139445a2d0f2e4888745..02157f87d7309f4fae54451e71d2c247096e8a53 100644 (file)
@@ -1,3 +1,4 @@
+#include <linux/kernel.h>
 #include <linux/sizes.h>
 
 #include "ddk750_help.h"
@@ -335,7 +336,7 @@ unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll)
                                unsigned int diff;
 
                                tmpClock = pll->inputFreq * M / N / X;
-                               diff = absDiff(tmpClock, request_orig);
+                               diff = abs(tmpClock - request_orig);
                                if (diff < mini_diff) {
                                        pll->M = M;
                                        pll->N = N;
index c070cf25a7d670b26c2e36cb4cf8e9f164930ea9..ce94d29588fe71f4bf88e3516b064d9d0606aac0 100644 (file)
 #define FIELD_SIZE(field)               (1 + FIELD_END(field) - FIELD_START(field))
 #define FIELD_MASK(field)               (((1 << (FIELD_SIZE(field)-1)) | ((1 << (FIELD_SIZE(field)-1)) - 1)) << FIELD_START(field))
 
-static inline unsigned int absDiff(unsigned int a, unsigned int b)
-{
-       if (a < b)
-               return b-a;
-       else
-               return a-b;
-}
-
 /* n / d + 1 / 2 = (2n + d) / 2d */
 #define roundedDiv(num, denom) ((2 * (num) + (denom)) / (2 * (denom)))
 #define MHz(x) ((x) * 1000000)