summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-05-14 18:43:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-05-14 22:52:49 -0400
commit2c64e9cb0b6b858901e9a386860d7d929d1cbaeb (patch)
tree749da0ef8f5d478680a523c877fb0e16fc18409c
parentb5c56e0cdd62979dd538e5363b06be5bdf735a09 (diff)
lib: Move mathematic helpers to separate folder
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>
-rw-r--r--Documentation/core-api/kernel-api.rst4
-rw-r--r--lib/Kconfig14
-rw-r--r--lib/Makefile15
-rw-r--r--lib/math/Kconfig11
-rw-r--r--lib/math/Makefile5
-rw-r--r--lib/math/cordic.c (renamed from lib/cordic.c)0
-rw-r--r--lib/math/div64.c (renamed from lib/div64.c)2
-rw-r--r--lib/math/gcd.c (renamed from lib/gcd.c)0
-rw-r--r--lib/math/int_sqrt.c (renamed from lib/int_sqrt.c)0
-rw-r--r--lib/math/lcm.c (renamed from lib/lcm.c)0
-rw-r--r--lib/math/prime_numbers.c (renamed from lib/prime_numbers.c)0
-rw-r--r--lib/math/rational.c (renamed from lib/rational.c)0
-rw-r--r--lib/math/reciprocal_div.c (renamed from lib/reciprocal_div.c)0
13 files changed, 27 insertions, 24 deletions
diff --git a/Documentation/core-api/kernel-api.rst b/Documentation/core-api/kernel-api.rst
index 71f5d2fe39b7..a29c99d13331 100644
--- a/Documentation/core-api/kernel-api.rst
+++ b/Documentation/core-api/kernel-api.rst
@@ -147,10 +147,10 @@ Division Functions
147.. kernel-doc:: include/linux/math64.h 147.. kernel-doc:: include/linux/math64.h
148 :internal: 148 :internal:
149 149
150.. kernel-doc:: lib/div64.c 150.. kernel-doc:: lib/math/div64.c
151 :functions: div_s64_rem div64_u64_rem div64_u64 div64_s64 151 :functions: div_s64_rem div64_u64_rem div64_u64 div64_s64
152 152
153.. kernel-doc:: lib/gcd.c 153.. kernel-doc:: lib/math/gcd.c
154 :export: 154 :export:
155 155
156UUID/GUID 156UUID/GUID
diff --git a/lib/Kconfig b/lib/Kconfig
index f323b85ad11c..3577609b61be 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -46,9 +46,6 @@ config HAVE_ARCH_BITREVERSE
46 This option enables the use of hardware bit-reversal instructions on 46 This option enables the use of hardware bit-reversal instructions on
47 architectures which support such operations. 47 architectures which support such operations.
48 48
49config RATIONAL
50 bool
51
52config GENERIC_STRNCPY_FROM_USER 49config GENERIC_STRNCPY_FROM_USER
53 bool 50 bool
54 51
@@ -61,6 +58,8 @@ config GENERIC_NET_UTILS
61config GENERIC_FIND_FIRST_BIT 58config GENERIC_FIND_FIRST_BIT
62 bool 59 bool
63 60
61source "lib/math/Kconfig"
62
64config NO_GENERIC_PCI_IOPORT_MAP 63config NO_GENERIC_PCI_IOPORT_MAP
65 bool 64 bool
66 65
@@ -531,12 +530,6 @@ config LRU_CACHE
531config CLZ_TAB 530config CLZ_TAB
532 bool 531 bool
533 532
534config CORDIC
535 tristate "CORDIC algorithm"
536 help
537 This option provides an implementation of the CORDIC algorithm;
538 calculations are in fixed point. Module will be called cordic.
539
540config DDR 533config DDR
541 bool "JEDEC DDR data" 534 bool "JEDEC DDR data"
542 help 535 help
@@ -628,9 +621,6 @@ config SBITMAP
628config PARMAN 621config PARMAN
629 tristate "parman" if COMPILE_TEST 622 tristate "parman" if COMPILE_TEST
630 623
631config PRIME_NUMBERS
632 tristate
633
634config STRING_SELFTEST 624config STRING_SELFTEST
635 tristate "Test string functions" 625 tristate "Test string functions"
636 626
diff --git a/lib/Makefile b/lib/Makefile
index 83d7df2661ff..fb7697031a79 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -30,7 +30,7 @@ endif
30 30
31lib-y := ctype.o string.o vsprintf.o cmdline.o \ 31lib-y := ctype.o string.o vsprintf.o cmdline.o \
32 rbtree.o radix-tree.o timerqueue.o xarray.o \ 32 rbtree.o radix-tree.o timerqueue.o xarray.o \
33 idr.o int_sqrt.o extable.o \ 33 idr.o extable.o \
34 sha1.o chacha.o irq_regs.o argv_split.o \ 34 sha1.o chacha.o irq_regs.o argv_split.o \
35 flex_proportions.o ratelimit.o show_mem.o \ 35 flex_proportions.o ratelimit.o show_mem.o \
36 is_single_threaded.o plist.o decompress.o kobject_uevent.o \ 36 is_single_threaded.o plist.o decompress.o kobject_uevent.o \
@@ -44,11 +44,11 @@ lib-$(CONFIG_SMP) += cpumask.o
44lib-y += kobject.o klist.o 44lib-y += kobject.o klist.o
45obj-y += lockref.o 45obj-y += lockref.o
46 46
47obj-y += bcd.o div64.o sort.o parser.o debug_locks.o random32.o \ 47obj-y += bcd.o sort.o parser.o debug_locks.o random32.o \
48 bust_spinlocks.o kasprintf.o bitmap.o scatterlist.o \ 48 bust_spinlocks.o kasprintf.o bitmap.o scatterlist.o \
49 gcd.o lcm.o list_sort.o uuid.o iov_iter.o clz_ctz.o \ 49 list_sort.o uuid.o iov_iter.o clz_ctz.o \
50 bsearch.o find_bit.o llist.o memweight.o kfifo.o \ 50 bsearch.o find_bit.o llist.o memweight.o kfifo.o \
51 percpu-refcount.o rhashtable.o reciprocal_div.o \ 51 percpu-refcount.o rhashtable.o \
52 once.o refcount.o usercopy.o errseq.o bucket_locks.o \ 52 once.o refcount.o usercopy.o errseq.o bucket_locks.o \
53 generic-radix-tree.o 53 generic-radix-tree.o
54obj-$(CONFIG_STRING_SELFTEST) += test_string.o 54obj-$(CONFIG_STRING_SELFTEST) += test_string.o
@@ -102,6 +102,8 @@ endif
102obj-$(CONFIG_DEBUG_INFO_REDUCED) += debug_info.o 102obj-$(CONFIG_DEBUG_INFO_REDUCED) += debug_info.o
103CFLAGS_debug_info.o += $(call cc-option, -femit-struct-debug-detailed=any) 103CFLAGS_debug_info.o += $(call cc-option, -femit-struct-debug-detailed=any)
104 104
105obj-y += math/
106
105obj-$(CONFIG_GENERIC_IOMAP) += iomap.o 107obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
106obj-$(CONFIG_GENERIC_PCI_IOMAP) += pci_iomap.o 108obj-$(CONFIG_GENERIC_PCI_IOMAP) += pci_iomap.o
107obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o 109obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o
@@ -121,7 +123,6 @@ obj-$(CONFIG_DEBUG_OBJECTS) += debugobjects.o
121 123
122obj-$(CONFIG_BITREVERSE) += bitrev.o 124obj-$(CONFIG_BITREVERSE) += bitrev.o
123obj-$(CONFIG_PACKING) += packing.o 125obj-$(CONFIG_PACKING) += packing.o
124obj-$(CONFIG_RATIONAL) += rational.o
125obj-$(CONFIG_CRC_CCITT) += crc-ccitt.o 126obj-$(CONFIG_CRC_CCITT) += crc-ccitt.o
126obj-$(CONFIG_CRC16) += crc16.o 127obj-$(CONFIG_CRC16) += crc16.o
127obj-$(CONFIG_CRC_T10DIF)+= crc-t10dif.o 128obj-$(CONFIG_CRC_T10DIF)+= crc-t10dif.o
@@ -195,8 +196,6 @@ obj-$(CONFIG_ATOMIC64_SELFTEST) += atomic64_test.o
195 196
196obj-$(CONFIG_CPU_RMAP) += cpu_rmap.o 197obj-$(CONFIG_CPU_RMAP) += cpu_rmap.o
197 198
198obj-$(CONFIG_CORDIC) += cordic.o
199
200obj-$(CONFIG_DQL) += dynamic_queue_limits.o 199obj-$(CONFIG_DQL) += dynamic_queue_limits.o
201 200
202obj-$(CONFIG_GLOB) += glob.o 201obj-$(CONFIG_GLOB) += glob.o
@@ -238,8 +237,6 @@ obj-$(CONFIG_ASN1) += asn1_decoder.o
238 237
239obj-$(CONFIG_FONT_SUPPORT) += fonts/ 238obj-$(CONFIG_FONT_SUPPORT) += fonts/
240 239
241obj-$(CONFIG_PRIME_NUMBERS) += prime_numbers.o
242
243hostprogs-y := gen_crc32table 240hostprogs-y := gen_crc32table
244hostprogs-y += gen_crc64table 241hostprogs-y += gen_crc64table
245clean-files := crc32table.h 242clean-files := crc32table.h
diff --git a/lib/math/Kconfig b/lib/math/Kconfig
new file mode 100644
index 000000000000..73bdf37178d1
--- /dev/null
+++ b/lib/math/Kconfig
@@ -0,0 +1,11 @@
1config CORDIC
2 tristate "CORDIC algorithm"
3 help
4 This option provides an implementation of the CORDIC algorithm;
5 calculations are in fixed point. Module will be called cordic.
6
7config PRIME_NUMBERS
8 tristate
9
10config RATIONAL
11 bool
diff --git a/lib/math/Makefile b/lib/math/Makefile
new file mode 100644
index 000000000000..b75878420da6
--- /dev/null
+++ b/lib/math/Makefile
@@ -0,0 +1,5 @@
1obj-y += div64.o gcd.o lcm.o int_sqrt.o reciprocal_div.o
2
3obj-$(CONFIG_CORDIC) += cordic.o
4obj-$(CONFIG_PRIME_NUMBERS) += prime_numbers.o
5obj-$(CONFIG_RATIONAL) += rational.o
diff --git a/lib/cordic.c b/lib/math/cordic.c
index 8ef27c12956f..8ef27c12956f 100644
--- a/lib/cordic.c
+++ b/lib/math/cordic.c
diff --git a/lib/div64.c b/lib/math/div64.c
index ee146bb4c558..368ca7fd0d82 100644
--- a/lib/div64.c
+++ b/lib/math/div64.c
@@ -10,7 +10,7 @@
10 * Generic C version of 64bit/32bit division and modulo, with 10 * Generic C version of 64bit/32bit division and modulo, with
11 * 64bit result and 32bit remainder. 11 * 64bit result and 32bit remainder.
12 * 12 *
13 * The fast case for (n>>32 == 0) is handled inline by do_div(). 13 * The fast case for (n>>32 == 0) is handled inline by do_div().
14 * 14 *
15 * Code generated for this function might be very inefficient 15 * Code generated for this function might be very inefficient
16 * for some CPUs. __div64_32() can be overridden by linking arch-specific 16 * for some CPUs. __div64_32() can be overridden by linking arch-specific
diff --git a/lib/gcd.c b/lib/math/gcd.c
index 7948ab27f0a4..7948ab27f0a4 100644
--- a/lib/gcd.c
+++ b/lib/math/gcd.c
diff --git a/lib/int_sqrt.c b/lib/math/int_sqrt.c
index 30e0f9770f88..30e0f9770f88 100644
--- a/lib/int_sqrt.c
+++ b/lib/math/int_sqrt.c
diff --git a/lib/lcm.c b/lib/math/lcm.c
index 03d7fcb420b5..03d7fcb420b5 100644
--- a/lib/lcm.c
+++ b/lib/math/lcm.c
diff --git a/lib/prime_numbers.c b/lib/math/prime_numbers.c
index 550eec457c2e..550eec457c2e 100644
--- a/lib/prime_numbers.c
+++ b/lib/math/prime_numbers.c
diff --git a/lib/rational.c b/lib/math/rational.c
index ba7443677c90..ba7443677c90 100644
--- a/lib/rational.c
+++ b/lib/math/rational.c
diff --git a/lib/reciprocal_div.c b/lib/math/reciprocal_div.c
index bf043258fa00..bf043258fa00 100644
--- a/lib/reciprocal_div.c
+++ b/lib/math/reciprocal_div.c