diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2019-05-14 18:43:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-14 22:52:49 -0400 |
commit | 2c64e9cb0b6b858901e9a386860d7d929d1cbaeb (patch) | |
tree | 749da0ef8f5d478680a523c877fb0e16fc18409c | |
parent | b5c56e0cdd62979dd538e5363b06be5bdf735a09 (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.rst | 4 | ||||
-rw-r--r-- | lib/Kconfig | 14 | ||||
-rw-r--r-- | lib/Makefile | 15 | ||||
-rw-r--r-- | lib/math/Kconfig | 11 | ||||
-rw-r--r-- | lib/math/Makefile | 5 | ||||
-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 | ||
156 | UUID/GUID | 156 | UUID/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 | ||
49 | config RATIONAL | ||
50 | bool | ||
51 | |||
52 | config GENERIC_STRNCPY_FROM_USER | 49 | config GENERIC_STRNCPY_FROM_USER |
53 | bool | 50 | bool |
54 | 51 | ||
@@ -61,6 +58,8 @@ config GENERIC_NET_UTILS | |||
61 | config GENERIC_FIND_FIRST_BIT | 58 | config GENERIC_FIND_FIRST_BIT |
62 | bool | 59 | bool |
63 | 60 | ||
61 | source "lib/math/Kconfig" | ||
62 | |||
64 | config NO_GENERIC_PCI_IOPORT_MAP | 63 | config NO_GENERIC_PCI_IOPORT_MAP |
65 | bool | 64 | bool |
66 | 65 | ||
@@ -531,12 +530,6 @@ config LRU_CACHE | |||
531 | config CLZ_TAB | 530 | config CLZ_TAB |
532 | bool | 531 | bool |
533 | 532 | ||
534 | config 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 | |||
540 | config DDR | 533 | config DDR |
541 | bool "JEDEC DDR data" | 534 | bool "JEDEC DDR data" |
542 | help | 535 | help |
@@ -628,9 +621,6 @@ config SBITMAP | |||
628 | config PARMAN | 621 | config PARMAN |
629 | tristate "parman" if COMPILE_TEST | 622 | tristate "parman" if COMPILE_TEST |
630 | 623 | ||
631 | config PRIME_NUMBERS | ||
632 | tristate | ||
633 | |||
634 | config STRING_SELFTEST | 624 | config 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 | ||
31 | lib-y := ctype.o string.o vsprintf.o cmdline.o \ | 31 | lib-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 | |||
44 | lib-y += kobject.o klist.o | 44 | lib-y += kobject.o klist.o |
45 | obj-y += lockref.o | 45 | obj-y += lockref.o |
46 | 46 | ||
47 | obj-y += bcd.o div64.o sort.o parser.o debug_locks.o random32.o \ | 47 | obj-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 |
54 | obj-$(CONFIG_STRING_SELFTEST) += test_string.o | 54 | obj-$(CONFIG_STRING_SELFTEST) += test_string.o |
@@ -102,6 +102,8 @@ endif | |||
102 | obj-$(CONFIG_DEBUG_INFO_REDUCED) += debug_info.o | 102 | obj-$(CONFIG_DEBUG_INFO_REDUCED) += debug_info.o |
103 | CFLAGS_debug_info.o += $(call cc-option, -femit-struct-debug-detailed=any) | 103 | CFLAGS_debug_info.o += $(call cc-option, -femit-struct-debug-detailed=any) |
104 | 104 | ||
105 | obj-y += math/ | ||
106 | |||
105 | obj-$(CONFIG_GENERIC_IOMAP) += iomap.o | 107 | obj-$(CONFIG_GENERIC_IOMAP) += iomap.o |
106 | obj-$(CONFIG_GENERIC_PCI_IOMAP) += pci_iomap.o | 108 | obj-$(CONFIG_GENERIC_PCI_IOMAP) += pci_iomap.o |
107 | obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o | 109 | obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o |
@@ -121,7 +123,6 @@ obj-$(CONFIG_DEBUG_OBJECTS) += debugobjects.o | |||
121 | 123 | ||
122 | obj-$(CONFIG_BITREVERSE) += bitrev.o | 124 | obj-$(CONFIG_BITREVERSE) += bitrev.o |
123 | obj-$(CONFIG_PACKING) += packing.o | 125 | obj-$(CONFIG_PACKING) += packing.o |
124 | obj-$(CONFIG_RATIONAL) += rational.o | ||
125 | obj-$(CONFIG_CRC_CCITT) += crc-ccitt.o | 126 | obj-$(CONFIG_CRC_CCITT) += crc-ccitt.o |
126 | obj-$(CONFIG_CRC16) += crc16.o | 127 | obj-$(CONFIG_CRC16) += crc16.o |
127 | obj-$(CONFIG_CRC_T10DIF)+= crc-t10dif.o | 128 | obj-$(CONFIG_CRC_T10DIF)+= crc-t10dif.o |
@@ -195,8 +196,6 @@ obj-$(CONFIG_ATOMIC64_SELFTEST) += atomic64_test.o | |||
195 | 196 | ||
196 | obj-$(CONFIG_CPU_RMAP) += cpu_rmap.o | 197 | obj-$(CONFIG_CPU_RMAP) += cpu_rmap.o |
197 | 198 | ||
198 | obj-$(CONFIG_CORDIC) += cordic.o | ||
199 | |||
200 | obj-$(CONFIG_DQL) += dynamic_queue_limits.o | 199 | obj-$(CONFIG_DQL) += dynamic_queue_limits.o |
201 | 200 | ||
202 | obj-$(CONFIG_GLOB) += glob.o | 201 | obj-$(CONFIG_GLOB) += glob.o |
@@ -238,8 +237,6 @@ obj-$(CONFIG_ASN1) += asn1_decoder.o | |||
238 | 237 | ||
239 | obj-$(CONFIG_FONT_SUPPORT) += fonts/ | 238 | obj-$(CONFIG_FONT_SUPPORT) += fonts/ |
240 | 239 | ||
241 | obj-$(CONFIG_PRIME_NUMBERS) += prime_numbers.o | ||
242 | |||
243 | hostprogs-y := gen_crc32table | 240 | hostprogs-y := gen_crc32table |
244 | hostprogs-y += gen_crc64table | 241 | hostprogs-y += gen_crc64table |
245 | clean-files := crc32table.h | 242 | clean-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 @@ | |||
1 | config 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 | |||
7 | config PRIME_NUMBERS | ||
8 | tristate | ||
9 | |||
10 | config 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 @@ | |||
1 | obj-y += div64.o gcd.o lcm.o int_sqrt.o reciprocal_div.o | ||
2 | |||
3 | obj-$(CONFIG_CORDIC) += cordic.o | ||
4 | obj-$(CONFIG_PRIME_NUMBERS) += prime_numbers.o | ||
5 | obj-$(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 | |||