aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig3
-rw-r--r--lib/Makefile1
-rw-r--r--lib/find_next_bit.c18
-rw-r--r--lib/show_mem.c7
-rw-r--r--lib/vsprintf.c7
5 files changed, 22 insertions, 14 deletions
diff --git a/lib/Kconfig b/lib/Kconfig
index 3a55a43c43eb..23fa7a359db7 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -22,6 +22,9 @@ config GENERIC_FIND_FIRST_BIT
22config GENERIC_FIND_NEXT_BIT 22config GENERIC_FIND_NEXT_BIT
23 bool 23 bool
24 24
25config GENERIC_FIND_BIT_LE
26 bool
27
25config GENERIC_FIND_LAST_BIT 28config GENERIC_FIND_LAST_BIT
26 bool 29 bool
27 default y 30 default y
diff --git a/lib/Makefile b/lib/Makefile
index 8c9de027ebb1..d7872b5c4c1c 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -40,6 +40,7 @@ lib-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += rwsem-spinlock.o
40lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o 40lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o
41lib-$(CONFIG_GENERIC_FIND_FIRST_BIT) += find_next_bit.o 41lib-$(CONFIG_GENERIC_FIND_FIRST_BIT) += find_next_bit.o
42lib-$(CONFIG_GENERIC_FIND_NEXT_BIT) += find_next_bit.o 42lib-$(CONFIG_GENERIC_FIND_NEXT_BIT) += find_next_bit.o
43lib-$(CONFIG_GENERIC_FIND_BIT_LE) += find_next_bit.o
43obj-$(CONFIG_GENERIC_FIND_LAST_BIT) += find_last_bit.o 44obj-$(CONFIG_GENERIC_FIND_LAST_BIT) += find_last_bit.o
44 45
45CFLAGS_hweight.o = $(subst $(quote),,$(CONFIG_ARCH_HWEIGHT_CFLAGS)) 46CFLAGS_hweight.o = $(subst $(quote),,$(CONFIG_ARCH_HWEIGHT_CFLAGS))
diff --git a/lib/find_next_bit.c b/lib/find_next_bit.c
index 24c59ded47a0..b0a8767282bf 100644
--- a/lib/find_next_bit.c
+++ b/lib/find_next_bit.c
@@ -160,6 +160,7 @@ EXPORT_SYMBOL(find_first_zero_bit);
160#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ 160#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */
161 161
162#ifdef __BIG_ENDIAN 162#ifdef __BIG_ENDIAN
163#ifdef CONFIG_GENERIC_FIND_BIT_LE
163 164
164/* include/linux/byteorder does not support "unsigned long" type */ 165/* include/linux/byteorder does not support "unsigned long" type */
165static inline unsigned long ext2_swabp(const unsigned long * x) 166static inline unsigned long ext2_swabp(const unsigned long * x)
@@ -185,15 +186,16 @@ static inline unsigned long ext2_swab(const unsigned long y)
185#endif 186#endif
186} 187}
187 188
188unsigned long generic_find_next_zero_le_bit(const unsigned long *addr, unsigned 189unsigned long find_next_zero_bit_le(const void *addr, unsigned
189 long size, unsigned long offset) 190 long size, unsigned long offset)
190{ 191{
191 const unsigned long *p = addr + BITOP_WORD(offset); 192 const unsigned long *p = addr;
192 unsigned long result = offset & ~(BITS_PER_LONG - 1); 193 unsigned long result = offset & ~(BITS_PER_LONG - 1);
193 unsigned long tmp; 194 unsigned long tmp;
194 195
195 if (offset >= size) 196 if (offset >= size)
196 return size; 197 return size;
198 p += BITOP_WORD(offset);
197 size -= result; 199 size -= result;
198 offset &= (BITS_PER_LONG - 1UL); 200 offset &= (BITS_PER_LONG - 1UL);
199 if (offset) { 201 if (offset) {
@@ -226,18 +228,18 @@ found_middle:
226found_middle_swap: 228found_middle_swap:
227 return result + ffz(ext2_swab(tmp)); 229 return result + ffz(ext2_swab(tmp));
228} 230}
231EXPORT_SYMBOL(find_next_zero_bit_le);
229 232
230EXPORT_SYMBOL(generic_find_next_zero_le_bit); 233unsigned long find_next_bit_le(const void *addr, unsigned
231
232unsigned long generic_find_next_le_bit(const unsigned long *addr, unsigned
233 long size, unsigned long offset) 234 long size, unsigned long offset)
234{ 235{
235 const unsigned long *p = addr + BITOP_WORD(offset); 236 const unsigned long *p = addr;
236 unsigned long result = offset & ~(BITS_PER_LONG - 1); 237 unsigned long result = offset & ~(BITS_PER_LONG - 1);
237 unsigned long tmp; 238 unsigned long tmp;
238 239
239 if (offset >= size) 240 if (offset >= size)
240 return size; 241 return size;
242 p += BITOP_WORD(offset);
241 size -= result; 243 size -= result;
242 offset &= (BITS_PER_LONG - 1UL); 244 offset &= (BITS_PER_LONG - 1UL);
243 if (offset) { 245 if (offset) {
@@ -271,5 +273,7 @@ found_middle:
271found_middle_swap: 273found_middle_swap:
272 return result + __ffs(ext2_swab(tmp)); 274 return result + __ffs(ext2_swab(tmp));
273} 275}
274EXPORT_SYMBOL(generic_find_next_le_bit); 276EXPORT_SYMBOL(find_next_bit_le);
277
278#endif /* CONFIG_GENERIC_FIND_BIT_LE */
275#endif /* __BIG_ENDIAN */ 279#endif /* __BIG_ENDIAN */
diff --git a/lib/show_mem.c b/lib/show_mem.c
index d8d602b58c31..90cbe4bb5960 100644
--- a/lib/show_mem.c
+++ b/lib/show_mem.c
@@ -9,7 +9,7 @@
9#include <linux/nmi.h> 9#include <linux/nmi.h>
10#include <linux/quicklist.h> 10#include <linux/quicklist.h>
11 11
12void __show_mem(unsigned int filter) 12void show_mem(unsigned int filter)
13{ 13{
14 pg_data_t *pgdat; 14 pg_data_t *pgdat;
15 unsigned long total = 0, reserved = 0, shared = 0, 15 unsigned long total = 0, reserved = 0, shared = 0,
@@ -61,8 +61,3 @@ void __show_mem(unsigned int filter)
61 quicklist_total_size()); 61 quicklist_total_size());
62#endif 62#endif
63} 63}
64
65void show_mem(void)
66{
67 __show_mem(0);
68}
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 02bcdd5feac4..bc0ac6b333dc 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -433,7 +433,9 @@ char *symbol_string(char *buf, char *end, void *ptr,
433 unsigned long value = (unsigned long) ptr; 433 unsigned long value = (unsigned long) ptr;
434#ifdef CONFIG_KALLSYMS 434#ifdef CONFIG_KALLSYMS
435 char sym[KSYM_SYMBOL_LEN]; 435 char sym[KSYM_SYMBOL_LEN];
436 if (ext != 'f' && ext != 's') 436 if (ext == 'B')
437 sprint_backtrace(sym, value);
438 else if (ext != 'f' && ext != 's')
437 sprint_symbol(sym, value); 439 sprint_symbol(sym, value);
438 else 440 else
439 kallsyms_lookup(value, NULL, NULL, NULL, sym); 441 kallsyms_lookup(value, NULL, NULL, NULL, sym);
@@ -808,6 +810,7 @@ int kptr_restrict = 1;
808 * - 'f' For simple symbolic function names without offset 810 * - 'f' For simple symbolic function names without offset
809 * - 'S' For symbolic direct pointers with offset 811 * - 'S' For symbolic direct pointers with offset
810 * - 's' For symbolic direct pointers without offset 812 * - 's' For symbolic direct pointers without offset
813 * - 'B' For backtraced symbolic direct pointers with offset
811 * - 'R' For decoded struct resource, e.g., [mem 0x0-0x1f 64bit pref] 814 * - 'R' For decoded struct resource, e.g., [mem 0x0-0x1f 64bit pref]
812 * - 'r' For raw struct resource, e.g., [mem 0x0-0x1f flags 0x201] 815 * - 'r' For raw struct resource, e.g., [mem 0x0-0x1f flags 0x201]
813 * - 'M' For a 6-byte MAC address, it prints the address in the 816 * - 'M' For a 6-byte MAC address, it prints the address in the
@@ -867,6 +870,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
867 /* Fallthrough */ 870 /* Fallthrough */
868 case 'S': 871 case 'S':
869 case 's': 872 case 's':
873 case 'B':
870 return symbol_string(buf, end, ptr, spec, *fmt); 874 return symbol_string(buf, end, ptr, spec, *fmt);
871 case 'R': 875 case 'R':
872 case 'r': 876 case 'r':
@@ -1134,6 +1138,7 @@ qualifier:
1134 * %ps output the name of a text symbol without offset 1138 * %ps output the name of a text symbol without offset
1135 * %pF output the name of a function pointer with its offset 1139 * %pF output the name of a function pointer with its offset
1136 * %pf output the name of a function pointer without its offset 1140 * %pf output the name of a function pointer without its offset
1141 * %pB output the name of a backtrace symbol with its offset
1137 * %pR output the address range in a struct resource with decoded flags 1142 * %pR output the address range in a struct resource with decoded flags
1138 * %pr output the address range in a struct resource with raw flags 1143 * %pr output the address range in a struct resource with raw flags
1139 * %pM output a 6-byte MAC address with colons 1144 * %pM output a 6-byte MAC address with colons