OSDN Git Service

lib: Move mathematic helpers to separate folder
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 14 May 2019 22:43:05 +0000 (15:43 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 15 May 2019 02:52:49 +0000 (19:52 -0700)
For better maintenance and expansion move the mathematic helpers to the
separate folder.

No functional change intended.

Note, the int_sqrt() is not used as a part of lib, so, moved to regular
obj.

Link: http://lkml.kernel.org/r/20190323172531.80025-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Ray Jui <rjui@broadcom.com>
[mchehab+samsung@kernel.org: fix broken doc references for div64.c and gcd.c]
Link: http://lkml.kernel.org/r/734f49bae5d4052b3c25691dfefad59bea2e5843.1555580999.git.mchehab+samsung@kernel.org
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 files changed:
Documentation/core-api/kernel-api.rst
lib/Kconfig
lib/Makefile
lib/math/Kconfig [new file with mode: 0644]
lib/math/Makefile [new file with mode: 0644]
lib/math/cordic.c [moved from lib/cordic.c with 100% similarity]
lib/math/div64.c [moved from lib/div64.c with 99% similarity]
lib/math/gcd.c [moved from lib/gcd.c with 100% similarity]
lib/math/int_sqrt.c [moved from lib/int_sqrt.c with 100% similarity]
lib/math/lcm.c [moved from lib/lcm.c with 100% similarity]
lib/math/prime_numbers.c [moved from lib/prime_numbers.c with 100% similarity]
lib/math/rational.c [moved from lib/rational.c with 100% similarity]
lib/math/reciprocal_div.c [moved from lib/reciprocal_div.c with 100% similarity]

index 71f5d2f..a29c99d 100644 (file)
@@ -147,10 +147,10 @@ Division Functions
 .. kernel-doc:: include/linux/math64.h
    :internal:
 
-.. kernel-doc:: lib/div64.c
+.. kernel-doc:: lib/math/div64.c
    :functions: div_s64_rem div64_u64_rem div64_u64 div64_s64
 
-.. kernel-doc:: lib/gcd.c
+.. kernel-doc:: lib/math/gcd.c
    :export:
 
 UUID/GUID
index f323b85..3577609 100644 (file)
@@ -46,9 +46,6 @@ config HAVE_ARCH_BITREVERSE
          This option enables the use of hardware bit-reversal instructions on
          architectures which support such operations.
 
-config RATIONAL
-       bool
-
 config GENERIC_STRNCPY_FROM_USER
        bool
 
@@ -61,6 +58,8 @@ config GENERIC_NET_UTILS
 config GENERIC_FIND_FIRST_BIT
        bool
 
+source "lib/math/Kconfig"
+
 config NO_GENERIC_PCI_IOPORT_MAP
        bool
 
@@ -531,12 +530,6 @@ config LRU_CACHE
 config CLZ_TAB
        bool
 
-config CORDIC
-       tristate "CORDIC algorithm"
-       help
-         This option provides an implementation of the CORDIC algorithm;
-         calculations are in fixed point. Module will be called cordic.
-
 config DDR
        bool "JEDEC DDR data"
        help
@@ -628,9 +621,6 @@ config SBITMAP
 config PARMAN
        tristate "parman" if COMPILE_TEST
 
-config PRIME_NUMBERS
-       tristate
-
 config STRING_SELFTEST
        tristate "Test string functions"
 
index 83d7df2..fb76970 100644 (file)
@@ -30,7 +30,7 @@ endif
 
 lib-y := ctype.o string.o vsprintf.o cmdline.o \
         rbtree.o radix-tree.o timerqueue.o xarray.o \
-        idr.o int_sqrt.o extable.o \
+        idr.o extable.o \
         sha1.o chacha.o irq_regs.o argv_split.o \
         flex_proportions.o ratelimit.o show_mem.o \
         is_single_threaded.o plist.o decompress.o kobject_uevent.o \
@@ -44,11 +44,11 @@ lib-$(CONFIG_SMP) += cpumask.o
 lib-y  += kobject.o klist.o
 obj-y  += lockref.o
 
-obj-y += bcd.o div64.o sort.o parser.o debug_locks.o random32.o \
+obj-y += bcd.o sort.o parser.o debug_locks.o random32.o \
         bust_spinlocks.o kasprintf.o bitmap.o scatterlist.o \
-        gcd.o lcm.o list_sort.o uuid.o iov_iter.o clz_ctz.o \
+        list_sort.o uuid.o iov_iter.o clz_ctz.o \
         bsearch.o find_bit.o llist.o memweight.o kfifo.o \
-        percpu-refcount.o rhashtable.o reciprocal_div.o \
+        percpu-refcount.o rhashtable.o \
         once.o refcount.o usercopy.o errseq.o bucket_locks.o \
         generic-radix-tree.o
 obj-$(CONFIG_STRING_SELFTEST) += test_string.o
@@ -102,6 +102,8 @@ endif
 obj-$(CONFIG_DEBUG_INFO_REDUCED) += debug_info.o
 CFLAGS_debug_info.o += $(call cc-option, -femit-struct-debug-detailed=any)
 
+obj-y += math/
+
 obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
 obj-$(CONFIG_GENERIC_PCI_IOMAP) += pci_iomap.o
 obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o
@@ -121,7 +123,6 @@ obj-$(CONFIG_DEBUG_OBJECTS) += debugobjects.o
 
 obj-$(CONFIG_BITREVERSE) += bitrev.o
 obj-$(CONFIG_PACKING)  += packing.o
-obj-$(CONFIG_RATIONAL) += rational.o
 obj-$(CONFIG_CRC_CCITT)        += crc-ccitt.o
 obj-$(CONFIG_CRC16)    += crc16.o
 obj-$(CONFIG_CRC_T10DIF)+= crc-t10dif.o
@@ -195,8 +196,6 @@ obj-$(CONFIG_ATOMIC64_SELFTEST) += atomic64_test.o
 
 obj-$(CONFIG_CPU_RMAP) += cpu_rmap.o
 
-obj-$(CONFIG_CORDIC) += cordic.o
-
 obj-$(CONFIG_DQL) += dynamic_queue_limits.o
 
 obj-$(CONFIG_GLOB) += glob.o
@@ -238,8 +237,6 @@ obj-$(CONFIG_ASN1) += asn1_decoder.o
 
 obj-$(CONFIG_FONT_SUPPORT) += fonts/
 
-obj-$(CONFIG_PRIME_NUMBERS) += prime_numbers.o
-
 hostprogs-y    := gen_crc32table
 hostprogs-y    += gen_crc64table
 clean-files    := crc32table.h
diff --git a/lib/math/Kconfig b/lib/math/Kconfig
new file mode 100644 (file)
index 0000000..73bdf37
--- /dev/null
@@ -0,0 +1,11 @@
+config CORDIC
+       tristate "CORDIC algorithm"
+       help
+         This option provides an implementation of the CORDIC algorithm;
+         calculations are in fixed point. Module will be called cordic.
+
+config PRIME_NUMBERS
+       tristate
+
+config RATIONAL
+       bool
diff --git a/lib/math/Makefile b/lib/math/Makefile
new file mode 100644 (file)
index 0000000..b758784
--- /dev/null
@@ -0,0 +1,5 @@
+obj-y += div64.o gcd.o lcm.o int_sqrt.o reciprocal_div.o
+
+obj-$(CONFIG_CORDIC)           += cordic.o
+obj-$(CONFIG_PRIME_NUMBERS)    += prime_numbers.o
+obj-$(CONFIG_RATIONAL)         += rational.o
similarity index 100%
rename from lib/cordic.c
rename to lib/math/cordic.c
similarity index 99%
rename from lib/div64.c
rename to lib/math/div64.c
index ee146bb..368ca7f 100644 (file)
@@ -10,7 +10,7 @@
  * Generic C version of 64bit/32bit division and modulo, with
  * 64bit result and 32bit remainder.
  *
- * The fast case for (n>>32 == 0) is handled inline by do_div(). 
+ * The fast case for (n>>32 == 0) is handled inline by do_div().
  *
  * Code generated for this function might be very inefficient
  * for some CPUs. __div64_32() can be overridden by linking arch-specific
similarity index 100%
rename from lib/gcd.c
rename to lib/math/gcd.c
similarity index 100%
rename from lib/int_sqrt.c
rename to lib/math/int_sqrt.c
similarity index 100%
rename from lib/lcm.c
rename to lib/math/lcm.c
similarity index 100%
rename from lib/prime_numbers.c
rename to lib/math/prime_numbers.c
similarity index 100%
rename from lib/rational.c
rename to lib/math/rational.c