drm/i915: Move abs_diff() to math.h
[sfrench/cifs-2.6.git] / drivers / gpu / ipu-v3 / ipu-image-convert.c
index af1612044eefdda7c203d8fa53fec362b42edf1b..841316582ea9d3b875df48632447c61a97c8e936 100644 (file)
@@ -7,7 +7,10 @@
 
 #include <linux/interrupt.h>
 #include <linux/dma-mapping.h>
+#include <linux/math.h>
+
 #include <video/imx-ipu-image-convert.h>
+
 #include "ipu-prv.h"
 
 /*
@@ -543,7 +546,7 @@ static void find_best_seam(struct ipu_image_convert_ctx *ctx,
                unsigned int in_pos;
                unsigned int in_pos_aligned;
                unsigned int in_pos_rounded;
-               unsigned int abs_diff;
+               unsigned int diff;
 
                /*
                 * Tiles in the right row / bottom column may not be allowed to
@@ -575,15 +578,11 @@ static void find_best_seam(struct ipu_image_convert_ctx *ctx,
                    (in_edge - in_pos_rounded) % in_burst)
                        continue;
 
-               if (in_pos < in_pos_aligned)
-                       abs_diff = in_pos_aligned - in_pos;
-               else
-                       abs_diff = in_pos - in_pos_aligned;
-
-               if (abs_diff < min_diff) {
+               diff = abs_diff(in_pos, in_pos_aligned);
+               if (diff < min_diff) {
                        in_seam = in_pos_rounded;
                        out_seam = out_pos;
-                       min_diff = abs_diff;
+                       min_diff = diff;
                }
        }