[PATCH 1/2] lib: drop separate int_sqrt.h header

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Linux defines int_sqrt in linux/math.h and has the implementations in
lib/math. We have both these locations, so move the existing code over
to simplify future sync of math functions.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 commands/fbtest.c         | 2 +-
 include/int_sqrt.h        | 8 --------
 include/linux/math.h      | 2 ++
 lib/Makefile              | 1 -
 lib/math/Makefile         | 1 +
 lib/{ => math}/int_sqrt.c | 4 ++--
 6 files changed, 6 insertions(+), 12 deletions(-)
 delete mode 100644 include/int_sqrt.h
 rename lib/{ => math}/int_sqrt.c (94%)

diff --git a/commands/fbtest.c b/commands/fbtest.c
index be1540d3d170..cee72b039371 100644
--- a/commands/fbtest.c
+++ b/commands/fbtest.c
@@ -9,7 +9,7 @@
 #include <gui/graphic_utils.h>
 #include <gui/2d-primitives.h>
 #include <linux/gcd.h>
-#include <int_sqrt.h>
+#include <linux/math.h>
 
 static void fbtest_pattern_solid(struct screen *sc, u32 color)
 {
diff --git a/include/int_sqrt.h b/include/int_sqrt.h
deleted file mode 100644
index d5dfd29ca088..000000000000
--- a/include/int_sqrt.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-
-#ifndef __INT_SQRT__
-#define __INT_SQRT__
-
-unsigned long int_sqrt(unsigned long x);
-
-#endif
diff --git a/include/linux/math.h b/include/linux/math.h
index f5d5cc714c4e..48417aca7635 100644
--- a/include/linux/math.h
+++ b/include/linux/math.h
@@ -81,4 +81,6 @@
 		(__x < 0) ? -__x : __x;         \
 	})
 
+unsigned long int_sqrt(unsigned long);
+
 #endif
diff --git a/lib/Makefile b/lib/Makefile
index 19d3a235dda5..41aed121267c 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -76,7 +76,6 @@ obj-$(CONFIG_RATP)	+= ratp.o
 obj-$(CONFIG_DEBUG_LIST) += list_debug.o
 obj-y			+= list_sort.o
 obj-y			+= refcount.o
-obj-y			+= int_sqrt.o
 obj-y			+= parseopt.o
 obj-y			+= clz_ctz.o
 obj-$(CONFIG_CRC_CCITT) += crc-ccitt.o
diff --git a/lib/math/Makefile b/lib/math/Makefile
index 2830dedb2ff9..71ab2b108689 100644
--- a/lib/math/Makefile
+++ b/lib/math/Makefile
@@ -3,3 +3,4 @@
 obj-y += div64.o
 pbl-y += div64.o
 obj-y += rational.o
+obj-y += int_sqrt.o
diff --git a/lib/int_sqrt.c b/lib/math/int_sqrt.c
similarity index 94%
rename from lib/int_sqrt.c
rename to lib/math/int_sqrt.c
index 24b3d5078299..105656d04661 100644
--- a/lib/int_sqrt.c
+++ b/lib/math/int_sqrt.c
@@ -11,8 +11,8 @@
  *
  */
 
-#include <common.h>
-#include <int_sqrt.h>
+#include <linux/math.h>
+#include <linux/export.h>
 
 /**
  * int_sqrt - rough approximation to sqrt
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux