aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig9
-rw-r--r--lib/Kconfig.debug18
-rw-r--r--lib/Makefile8
-rw-r--r--lib/bitmap.c8
-rw-r--r--lib/bust_spinlocks.c12
-rw-r--r--lib/cmdline.c8
-rw-r--r--lib/devres.c300
-rw-r--r--lib/idr.c4
-rw-r--r--lib/iomap.c3
-rw-r--r--lib/kobject.c5
-rw-r--r--lib/sha1.c9
-rw-r--r--lib/sort.c2
-rw-r--r--lib/string.c8
-rw-r--r--lib/swiotlb.c8
-rw-r--r--lib/textsearch.c2
-rw-r--r--lib/vsprintf.c15
16 files changed, 357 insertions, 62 deletions
diff --git a/lib/Kconfig b/lib/Kconfig
index 9b03581cde..3842499150 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -101,9 +101,14 @@ config TEXTSEARCH_FSM
101config PLIST 101config PLIST
102 boolean 102 boolean
103 103
104config IOMAP_COPY 104config HAS_IOMEM
105 boolean 105 boolean
106 depends on !UML 106 depends on !NO_IOMEM
107 default y
108
109config HAS_IOPORT
110 boolean
111 depends on HAS_IOMEM && !NO_IOPORT
107 default y 112 default y
108 113
109endmenu 114endmenu
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 5c2681875b..63f04c15e6 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -77,6 +77,15 @@ config DEBUG_KERNEL
77 Say Y here if you are developing drivers or trying to debug and 77 Say Y here if you are developing drivers or trying to debug and
78 identify kernel problems. 78 identify kernel problems.
79 79
80config DEBUG_SHIRQ
81 bool "Debug shared IRQ handlers"
82 depends on DEBUG_KERNEL && GENERIC_HARDIRQS
83 help
84 Enable this to generate a spurious interrupt as soon as a shared
85 interrupt handler is registered, and just before one is deregistered.
86 Drivers ought to be able to handle interrupts coming in at those
87 points; some don't and need to be caught.
88
80config LOG_BUF_SHIFT 89config LOG_BUF_SHIFT
81 int "Kernel log buffer size (16 => 64KB, 17 => 128KB)" if DEBUG_KERNEL 90 int "Kernel log buffer size (16 => 64KB, 17 => 128KB)" if DEBUG_KERNEL
82 range 12 21 91 range 12 21
@@ -181,19 +190,11 @@ config DEBUG_MUTEXES
181 This feature allows mutex semantics violations to be detected and 190 This feature allows mutex semantics violations to be detected and
182 reported. 191 reported.
183 192
184config DEBUG_RWSEMS
185 bool "RW-sem debugging: basic checks"
186 depends on DEBUG_KERNEL
187 help
188 This feature allows read-write semaphore semantics violations to
189 be detected and reported.
190
191config DEBUG_LOCK_ALLOC 193config DEBUG_LOCK_ALLOC
192 bool "Lock debugging: detect incorrect freeing of live locks" 194 bool "Lock debugging: detect incorrect freeing of live locks"
193 depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT 195 depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
194 select DEBUG_SPINLOCK 196 select DEBUG_SPINLOCK
195 select DEBUG_MUTEXES 197 select DEBUG_MUTEXES
196 select DEBUG_RWSEMS
197 select LOCKDEP 198 select LOCKDEP
198 help 199 help
199 This feature will check whether any held lock (spinlock, rwlock, 200 This feature will check whether any held lock (spinlock, rwlock,
@@ -209,7 +210,6 @@ config PROVE_LOCKING
209 select LOCKDEP 210 select LOCKDEP
210 select DEBUG_SPINLOCK 211 select DEBUG_SPINLOCK
211 select DEBUG_MUTEXES 212 select DEBUG_MUTEXES
212 select DEBUG_RWSEMS
213 select DEBUG_LOCK_ALLOC 213 select DEBUG_LOCK_ALLOC
214 default n 214 default n
215 help 215 help
diff --git a/lib/Makefile b/lib/Makefile
index 77b4bad7d4..992a39ef9f 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5lib-y := ctype.o string.o vsprintf.o cmdline.o \ 5lib-y := ctype.o string.o vsprintf.o cmdline.o \
6 bust_spinlocks.o rbtree.o radix-tree.o dump_stack.o \ 6 rbtree.o radix-tree.o dump_stack.o \
7 idr.o div64.o int_sqrt.o bitmap.o extable.o prio_tree.o \ 7 idr.o div64.o int_sqrt.o bitmap.o extable.o prio_tree.o \
8 sha1.o irq_regs.o reciprocal_div.o 8 sha1.o irq_regs.o reciprocal_div.o
9 9
@@ -12,14 +12,15 @@ lib-$(CONFIG_SMP) += cpumask.o
12 12
13lib-y += kobject.o kref.o kobject_uevent.o klist.o 13lib-y += kobject.o kref.o kobject_uevent.o klist.o
14 14
15obj-y += sort.o parser.o halfmd4.o debug_locks.o random32.o 15obj-y += sort.o parser.o halfmd4.o debug_locks.o random32.o bust_spinlocks.o
16 16
17ifeq ($(CONFIG_DEBUG_KOBJECT),y) 17ifeq ($(CONFIG_DEBUG_KOBJECT),y)
18CFLAGS_kobject.o += -DDEBUG 18CFLAGS_kobject.o += -DDEBUG
19CFLAGS_kobject_uevent.o += -DDEBUG 19CFLAGS_kobject_uevent.o += -DDEBUG
20endif 20endif
21 21
22obj-$(CONFIG_IOMAP_COPY) += iomap_copy.o 22obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
23obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o
23obj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o 24obj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o
24obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock_debug.o 25obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock_debug.o
25lib-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += rwsem-spinlock.o 26lib-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += rwsem-spinlock.o
@@ -41,7 +42,6 @@ obj-$(CONFIG_CRC_CCITT) += crc-ccitt.o
41obj-$(CONFIG_CRC16) += crc16.o 42obj-$(CONFIG_CRC16) += crc16.o
42obj-$(CONFIG_CRC32) += crc32.o 43obj-$(CONFIG_CRC32) += crc32.o
43obj-$(CONFIG_LIBCRC32C) += libcrc32c.o 44obj-$(CONFIG_LIBCRC32C) += libcrc32c.o
44obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
45obj-$(CONFIG_GENERIC_ALLOCATOR) += genalloc.o 45obj-$(CONFIG_GENERIC_ALLOCATOR) += genalloc.o
46 46
47obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate/ 47obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate/
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 037fa9aa2e..ee6e58fce8 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -95,7 +95,7 @@ void __bitmap_complement(unsigned long *dst, const unsigned long *src, int bits)
95} 95}
96EXPORT_SYMBOL(__bitmap_complement); 96EXPORT_SYMBOL(__bitmap_complement);
97 97
98/* 98/**
99 * __bitmap_shift_right - logical right shift of the bits in a bitmap 99 * __bitmap_shift_right - logical right shift of the bits in a bitmap
100 * @dst - destination bitmap 100 * @dst - destination bitmap
101 * @src - source bitmap 101 * @src - source bitmap
@@ -139,7 +139,7 @@ void __bitmap_shift_right(unsigned long *dst,
139EXPORT_SYMBOL(__bitmap_shift_right); 139EXPORT_SYMBOL(__bitmap_shift_right);
140 140
141 141
142/* 142/**
143 * __bitmap_shift_left - logical left shift of the bits in a bitmap 143 * __bitmap_shift_left - logical left shift of the bits in a bitmap
144 * @dst - destination bitmap 144 * @dst - destination bitmap
145 * @src - source bitmap 145 * @src - source bitmap
@@ -529,7 +529,7 @@ int bitmap_parselist(const char *bp, unsigned long *maskp, int nmaskbits)
529} 529}
530EXPORT_SYMBOL(bitmap_parselist); 530EXPORT_SYMBOL(bitmap_parselist);
531 531
532/* 532/**
533 * bitmap_pos_to_ord(buf, pos, bits) 533 * bitmap_pos_to_ord(buf, pos, bits)
534 * @buf: pointer to a bitmap 534 * @buf: pointer to a bitmap
535 * @pos: a bit position in @buf (0 <= @pos < @bits) 535 * @pos: a bit position in @buf (0 <= @pos < @bits)
@@ -804,7 +804,7 @@ EXPORT_SYMBOL(bitmap_find_free_region);
804 * @pos: beginning of bit region to release 804 * @pos: beginning of bit region to release
805 * @order: region size (log base 2 of number of bits) to release 805 * @order: region size (log base 2 of number of bits) to release
806 * 806 *
807 * This is the complement to __bitmap_find_free_region and releases 807 * This is the complement to __bitmap_find_free_region() and releases
808 * the found region (by clearing it in the bitmap). 808 * the found region (by clearing it in the bitmap).
809 * 809 *
810 * No return value. 810 * No return value.
diff --git a/lib/bust_spinlocks.c b/lib/bust_spinlocks.c
index a2055bc3ef..accb356581 100644
--- a/lib/bust_spinlocks.c
+++ b/lib/bust_spinlocks.c
@@ -14,24 +14,16 @@
14#include <linux/vt_kern.h> 14#include <linux/vt_kern.h>
15 15
16 16
17void bust_spinlocks(int yes) 17void __attribute__((weak)) bust_spinlocks(int yes)
18{ 18{
19 if (yes) { 19 if (yes) {
20 oops_in_progress = 1; 20 oops_in_progress = 1;
21 } else { 21 } else {
22 int loglevel_save = console_loglevel;
23#ifdef CONFIG_VT 22#ifdef CONFIG_VT
24 unblank_screen(); 23 unblank_screen();
25#endif 24#endif
26 oops_in_progress = 0; 25 oops_in_progress = 0;
27 /* 26 wake_up_klogd();
28 * OK, the message is on the console. Now we call printk()
29 * without oops_in_progress set so that printk() will give klogd
30 * and the blanked console a poke. Hold onto your hats...
31 */
32 console_loglevel = 15; /* NMI oopser may have shut the console up */
33 printk(" ");
34 console_loglevel = loglevel_save;
35 } 27 }
36} 28}
37 29
diff --git a/lib/cmdline.c b/lib/cmdline.c
index 8a5b5303bd..f596c08d21 100644
--- a/lib/cmdline.c
+++ b/lib/cmdline.c
@@ -43,10 +43,10 @@ static int get_range(char **str, int *pint)
43 * comma as well. 43 * comma as well.
44 * 44 *
45 * Return values: 45 * Return values:
46 * 0 : no int in string 46 * 0 - no int in string
47 * 1 : int found, no subsequent comma 47 * 1 - int found, no subsequent comma
48 * 2 : int found including a subsequent comma 48 * 2 - int found including a subsequent comma
49 * 3 : hyphen found to denote a range 49 * 3 - hyphen found to denote a range
50 */ 50 */
51 51
52int get_option (char **str, int *pint) 52int get_option (char **str, int *pint)
diff --git a/lib/devres.c b/lib/devres.c
new file mode 100644
index 0000000000..2a668dd7ca
--- /dev/null
+++ b/lib/devres.c
@@ -0,0 +1,300 @@
1#include <linux/pci.h>
2#include <linux/io.h>
3#include <linux/module.h>
4
5static void devm_ioremap_release(struct device *dev, void *res)
6{
7 iounmap(*(void __iomem **)res);
8}
9
10static int devm_ioremap_match(struct device *dev, void *res, void *match_data)
11{
12 return *(void **)res == match_data;
13}
14
15/**
16 * devm_ioremap - Managed ioremap()
17 * @dev: Generic device to remap IO address for
18 * @offset: BUS offset to map
19 * @size: Size of map
20 *
21 * Managed ioremap(). Map is automatically unmapped on driver detach.
22 */
23void __iomem *devm_ioremap(struct device *dev, unsigned long offset,
24 unsigned long size)
25{
26 void __iomem **ptr, *addr;
27
28 ptr = devres_alloc(devm_ioremap_release, sizeof(*ptr), GFP_KERNEL);
29 if (!ptr)
30 return NULL;
31
32 addr = ioremap(offset, size);
33 if (addr) {
34 *ptr = addr;
35 devres_add(dev, ptr);
36 } else
37 devres_free(ptr);
38
39 return addr;
40}
41EXPORT_SYMBOL(devm_ioremap);
42
43/**
44 * devm_ioremap_nocache - Managed ioremap_nocache()
45 * @dev: Generic device to remap IO address for
46 * @offset: BUS offset to map
47 * @size: Size of map
48 *
49 * Managed ioremap_nocache(). Map is automatically unmapped on driver
50 * detach.
51 */
52void __iomem *devm_ioremap_nocache(struct device *dev, unsigned long offset,
53 unsigned long size)
54{
55 void __iomem **ptr, *addr;
56
57 ptr = devres_alloc(devm_ioremap_release, sizeof(*ptr), GFP_KERNEL);
58 if (!ptr)
59 return NULL;
60
61 addr = ioremap_nocache(offset, size);
62 if (addr) {
63 *ptr = addr;
64 devres_add(dev, ptr);
65 } else
66 devres_free(ptr);
67
68 return addr;
69}
70EXPORT_SYMBOL(devm_ioremap_nocache);
71
72/**
73 * devm_iounmap - Managed iounmap()
74 * @dev: Generic device to unmap for
75 * @addr: Address to unmap
76 *
77 * Managed iounmap(). @addr must have been mapped using devm_ioremap*().
78 */
79void devm_iounmap(struct device *dev, void __iomem *addr)
80{
81 iounmap(addr);
82 WARN_ON(devres_destroy(dev, devm_ioremap_release, devm_ioremap_match,
83 (void *)addr));
84}
85EXPORT_SYMBOL(devm_iounmap);
86
87#ifdef CONFIG_HAS_IOPORT
88/*
89 * Generic iomap devres
90 */
91static void devm_ioport_map_release(struct device *dev, void *res)
92{
93 ioport_unmap(*(void __iomem **)res);
94}
95
96static int devm_ioport_map_match(struct device *dev, void *res,
97 void *match_data)
98{
99 return *(void **)res == match_data;
100}
101
102/**
103 * devm_ioport_map - Managed ioport_map()
104 * @dev: Generic device to map ioport for
105 * @port: Port to map
106 * @nr: Number of ports to map
107 *
108 * Managed ioport_map(). Map is automatically unmapped on driver
109 * detach.
110 */
111void __iomem * devm_ioport_map(struct device *dev, unsigned long port,
112 unsigned int nr)
113{
114 void __iomem **ptr, *addr;
115
116 ptr = devres_alloc(devm_ioport_map_release, sizeof(*ptr), GFP_KERNEL);
117 if (!ptr)
118 return NULL;
119
120 addr = ioport_map(port, nr);
121 if (addr) {
122 *ptr = addr;
123 devres_add(dev, ptr);
124 } else
125 devres_free(ptr);
126
127 return addr;
128}
129EXPORT_SYMBOL(devm_ioport_map);
130
131/**
132 * devm_ioport_unmap - Managed ioport_unmap()
133 * @dev: Generic device to unmap for
134 * @addr: Address to unmap
135 *
136 * Managed ioport_unmap(). @addr must have been mapped using
137 * devm_ioport_map().
138 */
139void devm_ioport_unmap(struct device *dev, void __iomem *addr)
140{
141 ioport_unmap(addr);
142 WARN_ON(devres_destroy(dev, devm_ioport_map_release,
143 devm_ioport_map_match, (void *)addr));
144}
145EXPORT_SYMBOL(devm_ioport_unmap);
146
147#ifdef CONFIG_PCI
148/*
149 * PCI iomap devres
150 */
151#define PCIM_IOMAP_MAX PCI_ROM_RESOURCE
152
153struct pcim_iomap_devres {
154 void __iomem *table[PCIM_IOMAP_MAX];
155};
156
157static void pcim_iomap_release(struct device *gendev, void *res)
158{
159 struct pci_dev *dev = container_of(gendev, struct pci_dev, dev);
160 struct pcim_iomap_devres *this = res;
161 int i;
162
163 for (i = 0; i < PCIM_IOMAP_MAX; i++)
164 if (this->table[i])
165 pci_iounmap(dev, this->table[i]);
166}
167
168/**
169 * pcim_iomap_table - access iomap allocation table
170 * @pdev: PCI device to access iomap table for
171 *
172 * Access iomap allocation table for @dev. If iomap table doesn't
173 * exist and @pdev is managed, it will be allocated. All iomaps
174 * recorded in the iomap table are automatically unmapped on driver
175 * detach.
176 *
177 * This function might sleep when the table is first allocated but can
178 * be safely called without context and guaranteed to succed once
179 * allocated.
180 */
181void __iomem * const * pcim_iomap_table(struct pci_dev *pdev)
182{
183 struct pcim_iomap_devres *dr, *new_dr;
184
185 dr = devres_find(&pdev->dev, pcim_iomap_release, NULL, NULL);
186 if (dr)
187 return dr->table;
188
189 new_dr = devres_alloc(pcim_iomap_release, sizeof(*new_dr), GFP_KERNEL);
190 if (!new_dr)
191 return NULL;
192 dr = devres_get(&pdev->dev, new_dr, NULL, NULL);
193 return dr->table;
194}
195EXPORT_SYMBOL(pcim_iomap_table);
196
197/**
198 * pcim_iomap - Managed pcim_iomap()
199 * @pdev: PCI device to iomap for
200 * @bar: BAR to iomap
201 * @maxlen: Maximum length of iomap
202 *
203 * Managed pci_iomap(). Map is automatically unmapped on driver
204 * detach.
205 */
206void __iomem * pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen)
207{
208 void __iomem **tbl;
209
210 BUG_ON(bar >= PCIM_IOMAP_MAX);
211
212 tbl = (void __iomem **)pcim_iomap_table(pdev);
213 if (!tbl || tbl[bar]) /* duplicate mappings not allowed */
214 return NULL;
215
216 tbl[bar] = pci_iomap(pdev, bar, maxlen);
217 return tbl[bar];
218}
219EXPORT_SYMBOL(pcim_iomap);
220
221/**
222 * pcim_iounmap - Managed pci_iounmap()
223 * @pdev: PCI device to iounmap for
224 * @addr: Address to unmap
225 *
226 * Managed pci_iounmap(). @addr must have been mapped using pcim_iomap().
227 */
228void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr)
229{
230 void __iomem **tbl;
231 int i;
232
233 pci_iounmap(pdev, addr);
234
235 tbl = (void __iomem **)pcim_iomap_table(pdev);
236 BUG_ON(!tbl);
237
238 for (i = 0; i < PCIM_IOMAP_MAX; i++)
239 if (tbl[i] == addr) {
240 tbl[i] = NULL;
241 return;
242 }
243 WARN_ON(1);
244}
245EXPORT_SYMBOL(pcim_iounmap);
246
247/**
248 * pcim_iomap_regions - Request and iomap PCI BARs
249 * @pdev: PCI device to map IO resources for
250 * @mask: Mask of BARs to request and iomap
251 * @name: Name used when requesting regions
252 *
253 * Request and iomap regions specified by @mask.
254 */
255int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name)
256{
257 void __iomem * const *iomap;
258 int i, rc;
259
260 iomap = pcim_iomap_table(pdev);
261 if (!iomap)
262 return -ENOMEM;
263
264 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
265 unsigned long len;
266
267 if (!(mask & (1 << i)))
268 continue;
269
270 rc = -EINVAL;
271 len = pci_resource_len(pdev, i);
272 if (!len)
273 goto err_inval;
274
275 rc = pci_request_region(pdev, i, name);
276 if (rc)
277 goto err_region;
278
279 rc = -ENOMEM;
280 if (!pcim_iomap(pdev, i, 0))
281 goto err_iomap;
282 }
283
284 return 0;
285
286 err_iomap:
287 pcim_iounmap(pdev, iomap[i]);
288 err_region:
289 pci_release_region(pdev, i);
290 err_inval:
291 while (--i >= 0) {
292 pcim_iounmap(pdev, iomap[i]);
293 pci_release_region(pdev, i);
294 }
295
296 return rc;
297}
298EXPORT_SYMBOL(pcim_iomap_regions);
299#endif
300#endif
diff --git a/lib/idr.c b/lib/idr.c
index 71853531d3..305117ca2d 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -329,8 +329,8 @@ static void sub_remove(struct idr *idp, int shift, int id)
329 329
330/** 330/**
331 * idr_remove - remove the given id and free it's slot 331 * idr_remove - remove the given id and free it's slot
332 * idp: idr handle 332 * @idp: idr handle
333 * id: uniqueue key 333 * @id: unique key
334 */ 334 */
335void idr_remove(struct idr *idp, int id) 335void idr_remove(struct idr *idp, int id)
336{ 336{
diff --git a/lib/iomap.c b/lib/iomap.c
index d6ccdd85df..4d43f37c01 100644
--- a/lib/iomap.c
+++ b/lib/iomap.c
@@ -4,8 +4,9 @@
4 * (C) Copyright 2004 Linus Torvalds 4 * (C) Copyright 2004 Linus Torvalds
5 */ 5 */
6#include <linux/pci.h> 6#include <linux/pci.h>
7#include <linux/io.h>
8
7#include <linux/module.h> 9#include <linux/module.h>
8#include <asm/io.h>
9 10
10/* 11/*
11 * Read/write from/to an (offsettable) iomem cookie. It might be a PIO 12 * Read/write from/to an (offsettable) iomem cookie. It might be a PIO
diff --git a/lib/kobject.c b/lib/kobject.c
index c2917ffe8b..2782f49e90 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -97,11 +97,12 @@ static void fill_kobj_path(struct kobject *kobj, char *path, int length)
97} 97}
98 98
99/** 99/**
100 * kobject_get_path - generate and return the path associated with a given kobj 100 * kobject_get_path - generate and return the path associated with a given kobj and kset pair.
101 * and kset pair. The result must be freed by the caller with kfree().
102 * 101 *
103 * @kobj: kobject in question, with which to build the path 102 * @kobj: kobject in question, with which to build the path
104 * @gfp_mask: the allocation type used to allocate the path 103 * @gfp_mask: the allocation type used to allocate the path
104 *
105 * The result must be freed by the caller with kfree().
105 */ 106 */
106char *kobject_get_path(struct kobject *kobj, gfp_t gfp_mask) 107char *kobject_get_path(struct kobject *kobj, gfp_t gfp_mask)
107{ 108{
diff --git a/lib/sha1.c b/lib/sha1.c
index 1cdabe3065..4c45fd50e9 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -20,8 +20,8 @@
20#define K3 0x8F1BBCDCL /* Rounds 40-59: sqrt(5) * 2^30 */ 20#define K3 0x8F1BBCDCL /* Rounds 40-59: sqrt(5) * 2^30 */
21#define K4 0xCA62C1D6L /* Rounds 60-79: sqrt(10) * 2^30 */ 21#define K4 0xCA62C1D6L /* Rounds 60-79: sqrt(10) * 2^30 */
22 22
23/* 23/**
24 * sha_transform: single block SHA1 transform 24 * sha_transform - single block SHA1 transform
25 * 25 *
26 * @digest: 160 bit digest to update 26 * @digest: 160 bit digest to update
27 * @data: 512 bits of data to hash 27 * @data: 512 bits of data to hash
@@ -80,9 +80,8 @@ void sha_transform(__u32 *digest, const char *in, __u32 *W)
80} 80}
81EXPORT_SYMBOL(sha_transform); 81EXPORT_SYMBOL(sha_transform);
82 82
83/* 83/**
84 * sha_init: initialize the vectors for a SHA1 digest 84 * sha_init - initialize the vectors for a SHA1 digest
85 *
86 * @buf: vector to initialize 85 * @buf: vector to initialize
87 */ 86 */
88void sha_init(__u32 *buf) 87void sha_init(__u32 *buf)
diff --git a/lib/sort.c b/lib/sort.c
index 488788b341..961567894d 100644
--- a/lib/sort.c
+++ b/lib/sort.c
@@ -27,7 +27,7 @@ static void generic_swap(void *a, void *b, int size)
27 } while (--size > 0); 27 } while (--size > 0);
28} 28}
29 29
30/* 30/**
31 * sort - sort an array of elements 31 * sort - sort an array of elements
32 * @base: pointer to data to sort 32 * @base: pointer to data to sort
33 * @num: number of elements 33 * @num: number of elements
diff --git a/lib/string.c b/lib/string.c
index a485d75962..bab440fb0d 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -160,7 +160,7 @@ EXPORT_SYMBOL(strcat);
160 * @src: The string to append to it 160 * @src: The string to append to it
161 * @count: The maximum numbers of bytes to copy 161 * @count: The maximum numbers of bytes to copy
162 * 162 *
163 * Note that in contrast to strncpy, strncat ensures the result is 163 * Note that in contrast to strncpy(), strncat() ensures the result is
164 * terminated. 164 * terminated.
165 */ 165 */
166char *strncat(char *dest, const char *src, size_t count) 166char *strncat(char *dest, const char *src, size_t count)
@@ -366,8 +366,7 @@ EXPORT_SYMBOL(strnlen);
366 366
367#ifndef __HAVE_ARCH_STRSPN 367#ifndef __HAVE_ARCH_STRSPN
368/** 368/**
369 * strspn - Calculate the length of the initial substring of @s which only 369 * strspn - Calculate the length of the initial substring of @s which only contain letters in @accept
370 * contain letters in @accept
371 * @s: The string to be searched 370 * @s: The string to be searched
372 * @accept: The string to search for 371 * @accept: The string to search for
373 */ 372 */
@@ -394,8 +393,7 @@ EXPORT_SYMBOL(strspn);
394 393
395#ifndef __HAVE_ARCH_STRCSPN 394#ifndef __HAVE_ARCH_STRCSPN
396/** 395/**
397 * strcspn - Calculate the length of the initial substring of @s which does 396 * strcspn - Calculate the length of the initial substring of @s which does not contain letters in @reject
398 * not contain letters in @reject
399 * @s: The string to be searched 397 * @s: The string to be searched
400 * @reject: The string to avoid 398 * @reject: The string to avoid
401 */ 399 */
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 50a4380101..623a68af8b 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -313,7 +313,7 @@ cleanup1:
313#endif 313#endif
314 314
315#ifndef SWIOTLB_ARCH_HAS_NEEDS_MAPPING 315#ifndef SWIOTLB_ARCH_HAS_NEEDS_MAPPING
316static inline int 316static int
317address_needs_mapping(struct device *hwdev, dma_addr_t addr) 317address_needs_mapping(struct device *hwdev, dma_addr_t addr)
318{ 318{
319 dma_addr_t mask = 0xffffffff; 319 dma_addr_t mask = 0xffffffff;
@@ -672,7 +672,7 @@ swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr, size_t size,
672 * address back to the card, you must first perform a 672 * address back to the card, you must first perform a
673 * swiotlb_dma_sync_for_device, and then the device again owns the buffer 673 * swiotlb_dma_sync_for_device, and then the device again owns the buffer
674 */ 674 */
675static inline void 675static void
676swiotlb_sync_single(struct device *hwdev, dma_addr_t dev_addr, 676swiotlb_sync_single(struct device *hwdev, dma_addr_t dev_addr,
677 size_t size, int dir, int target) 677 size_t size, int dir, int target)
678{ 678{
@@ -702,7 +702,7 @@ swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr,
702/* 702/*
703 * Same as above, but for a sub-range of the mapping. 703 * Same as above, but for a sub-range of the mapping.
704 */ 704 */
705static inline void 705static void
706swiotlb_sync_single_range(struct device *hwdev, dma_addr_t dev_addr, 706swiotlb_sync_single_range(struct device *hwdev, dma_addr_t dev_addr,
707 unsigned long offset, size_t size, 707 unsigned long offset, size_t size,
708 int dir, int target) 708 int dir, int target)
@@ -805,7 +805,7 @@ swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nelems,
805 * The same as swiotlb_sync_single_* but for a scatter-gather list, same rules 805 * The same as swiotlb_sync_single_* but for a scatter-gather list, same rules
806 * and usage. 806 * and usage.
807 */ 807 */
808static inline void 808static void
809swiotlb_sync_sg(struct device *hwdev, struct scatterlist *sg, 809swiotlb_sync_sg(struct device *hwdev, struct scatterlist *sg,
810 int nelems, int dir, int target) 810 int nelems, int dir, int target)
811{ 811{
diff --git a/lib/textsearch.c b/lib/textsearch.c
index 98bcadc011..9e2a002c5b 100644
--- a/lib/textsearch.c
+++ b/lib/textsearch.c
@@ -218,7 +218,7 @@ static unsigned int get_linear_data(unsigned int consumed, const u8 **dst,
218 * Call textsearch_next() to retrieve subsequent matches. 218 * Call textsearch_next() to retrieve subsequent matches.
219 * 219 *
220 * Returns the position of first occurrence of the pattern or 220 * Returns the position of first occurrence of the pattern or
221 * UINT_MAX if no occurrence was found. 221 * %UINT_MAX if no occurrence was found.
222 */ 222 */
223unsigned int textsearch_find_continuous(struct ts_config *conf, 223unsigned int textsearch_find_continuous(struct ts_config *conf,
224 struct ts_state *state, 224 struct ts_state *state,
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index bed7229378..b025864d2e 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -247,12 +247,12 @@ static char * number(char * buf, char * end, unsigned long long num, int base, i
247 * be generated for the given input, excluding the trailing 247 * be generated for the given input, excluding the trailing
248 * '\0', as per ISO C99. If you want to have the exact 248 * '\0', as per ISO C99. If you want to have the exact
249 * number of characters written into @buf as return value 249 * number of characters written into @buf as return value
250 * (not including the trailing '\0'), use vscnprintf. If the 250 * (not including the trailing '\0'), use vscnprintf(). If the
251 * return is greater than or equal to @size, the resulting 251 * return is greater than or equal to @size, the resulting
252 * string is truncated. 252 * string is truncated.
253 * 253 *
254 * Call this function if you are already dealing with a va_list. 254 * Call this function if you are already dealing with a va_list.
255 * You probably want snprintf instead. 255 * You probably want snprintf() instead.
256 */ 256 */
257int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) 257int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
258{ 258{
@@ -509,7 +509,7 @@ EXPORT_SYMBOL(vsnprintf);
509 * returns 0. 509 * returns 0.
510 * 510 *
511 * Call this function if you are already dealing with a va_list. 511 * Call this function if you are already dealing with a va_list.
512 * You probably want scnprintf instead. 512 * You probably want scnprintf() instead.
513 */ 513 */
514int vscnprintf(char *buf, size_t size, const char *fmt, va_list args) 514int vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
515{ 515{
@@ -554,8 +554,7 @@ EXPORT_SYMBOL(snprintf);
554 * @...: Arguments for the format string 554 * @...: Arguments for the format string
555 * 555 *
556 * The return value is the number of characters written into @buf not including 556 * The return value is the number of characters written into @buf not including
557 * the trailing '\0'. If @size is <= 0 the function returns 0. If the return is 557 * the trailing '\0'. If @size is <= 0 the function returns 0.
558 * greater than or equal to @size, the resulting string is truncated.
559 */ 558 */
560 559
561int scnprintf(char * buf, size_t size, const char *fmt, ...) 560int scnprintf(char * buf, size_t size, const char *fmt, ...)
@@ -577,11 +576,11 @@ EXPORT_SYMBOL(scnprintf);
577 * @args: Arguments for the format string 576 * @args: Arguments for the format string
578 * 577 *
579 * The function returns the number of characters written 578 * The function returns the number of characters written
580 * into @buf. Use vsnprintf or vscnprintf in order to avoid 579 * into @buf. Use vsnprintf() or vscnprintf() in order to avoid
581 * buffer overflows. 580 * buffer overflows.
582 * 581 *
583 * Call this function if you are already dealing with a va_list. 582 * Call this function if you are already dealing with a va_list.
584 * You probably want sprintf instead. 583 * You probably want sprintf() instead.
585 */ 584 */
586int vsprintf(char *buf, const char *fmt, va_list args) 585int vsprintf(char *buf, const char *fmt, va_list args)
587{ 586{
@@ -597,7 +596,7 @@ EXPORT_SYMBOL(vsprintf);
597 * @...: Arguments for the format string 596 * @...: Arguments for the format string
598 * 597 *
599 * The function returns the number of characters written 598 * The function returns the number of characters written
600 * into @buf. Use snprintf or scnprintf in order to avoid 599 * into @buf. Use snprintf() or scnprintf() in order to avoid
601 * buffer overflows. 600 * buffer overflows.
602 */ 601 */
603int sprintf(char * buf, const char *fmt, ...) 602int sprintf(char * buf, const char *fmt, ...)