aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2010-03-19 03:05:10 -0400
committerJens Axboe <jens.axboe@oracle.com>2010-03-19 03:05:10 -0400
commitb4b7a4ef097f288f724420b473dbf92a89c0ab7e (patch)
tree23ad8101e3e77c32a8d1e1b95a9c1cd7f7a475b7 /lib
parente9ce335df51ff782035a15c261a3c0c9892a1767 (diff)
parenta3d3203e4bb40f253b1541e310dc0f9305be7c84 (diff)
Merge branch 'master' into for-linus
Conflicts: block/Kconfig Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig.debug8
-rw-r--r--lib/kobject.c6
-rw-r--r--lib/kobject_uevent.c2
-rw-r--r--lib/vsprintf.c13
-rw-r--r--lib/zlib_inflate/inffast.c72
5 files changed, 55 insertions, 46 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index b520ec1f33c5..8e5ec5e1ab91 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -532,6 +532,14 @@ config LOCK_STAT
532 532
533 For more details, see Documentation/lockstat.txt 533 For more details, see Documentation/lockstat.txt
534 534
535 This also enables lock events required by "perf lock",
536 subcommand of perf.
537 If you want to use "perf lock", you also need to turn on
538 CONFIG_EVENT_TRACING.
539
540 CONFIG_LOCK_STAT defines "contended" and "acquired" lock events.
541 (CONFIG_LOCKDEP defines "acquire" and "release" events.)
542
535config DEBUG_LOCKDEP 543config DEBUG_LOCKDEP
536 bool "Lock dependency engine debugging" 544 bool "Lock dependency engine debugging"
537 depends on DEBUG_KERNEL && LOCKDEP 545 depends on DEBUG_KERNEL && LOCKDEP
diff --git a/lib/kobject.c b/lib/kobject.c
index b512b746d2af..8115eb1bbf4d 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -700,7 +700,7 @@ static ssize_t kobj_attr_store(struct kobject *kobj, struct attribute *attr,
700 return ret; 700 return ret;
701} 701}
702 702
703struct sysfs_ops kobj_sysfs_ops = { 703const struct sysfs_ops kobj_sysfs_ops = {
704 .show = kobj_attr_show, 704 .show = kobj_attr_show,
705 .store = kobj_attr_store, 705 .store = kobj_attr_store,
706}; 706};
@@ -789,7 +789,7 @@ static struct kobj_type kset_ktype = {
789 * If the kset was not able to be created, NULL will be returned. 789 * If the kset was not able to be created, NULL will be returned.
790 */ 790 */
791static struct kset *kset_create(const char *name, 791static struct kset *kset_create(const char *name,
792 struct kset_uevent_ops *uevent_ops, 792 const struct kset_uevent_ops *uevent_ops,
793 struct kobject *parent_kobj) 793 struct kobject *parent_kobj)
794{ 794{
795 struct kset *kset; 795 struct kset *kset;
@@ -832,7 +832,7 @@ static struct kset *kset_create(const char *name,
832 * If the kset was not able to be created, NULL will be returned. 832 * If the kset was not able to be created, NULL will be returned.
833 */ 833 */
834struct kset *kset_create_and_add(const char *name, 834struct kset *kset_create_and_add(const char *name,
835 struct kset_uevent_ops *uevent_ops, 835 const struct kset_uevent_ops *uevent_ops,
836 struct kobject *parent_kobj) 836 struct kobject *parent_kobj)
837{ 837{
838 struct kset *kset; 838 struct kset *kset;
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 920a3ca6e259..c9d3a3e8405d 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -95,7 +95,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
95 const char *subsystem; 95 const char *subsystem;
96 struct kobject *top_kobj; 96 struct kobject *top_kobj;
97 struct kset *kset; 97 struct kset *kset;
98 struct kset_uevent_ops *uevent_ops; 98 const struct kset_uevent_ops *uevent_ops;
99 u64 seq; 99 u64 seq;
100 int i = 0; 100 int i = 0;
101 int retval = 0; 101 int retval = 0;
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 0d461c7c14db..24112e5a5780 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -609,6 +609,12 @@ static char *resource_string(char *buf, char *end, struct resource *res,
609 .precision = -1, 609 .precision = -1,
610 .flags = SPECIAL | SMALL | ZEROPAD, 610 .flags = SPECIAL | SMALL | ZEROPAD,
611 }; 611 };
612 static const struct printf_spec bus_spec = {
613 .base = 16,
614 .field_width = 2,
615 .precision = -1,
616 .flags = SMALL | ZEROPAD,
617 };
612 static const struct printf_spec dec_spec = { 618 static const struct printf_spec dec_spec = {
613 .base = 10, 619 .base = 10,
614 .precision = -1, 620 .precision = -1,
@@ -629,7 +635,7 @@ static char *resource_string(char *buf, char *end, struct resource *res,
629 * 64-bit res (sizeof==8): 20 chars in dec, 18 in hex ("0x" + 16) */ 635 * 64-bit res (sizeof==8): 20 chars in dec, 18 in hex ("0x" + 16) */
630#define RSRC_BUF_SIZE ((2 * sizeof(resource_size_t)) + 4) 636#define RSRC_BUF_SIZE ((2 * sizeof(resource_size_t)) + 4)
631#define FLAG_BUF_SIZE (2 * sizeof(res->flags)) 637#define FLAG_BUF_SIZE (2 * sizeof(res->flags))
632#define DECODED_BUF_SIZE sizeof("[mem - 64bit pref disabled]") 638#define DECODED_BUF_SIZE sizeof("[mem - 64bit pref window disabled]")
633#define RAW_BUF_SIZE sizeof("[mem - flags 0x]") 639#define RAW_BUF_SIZE sizeof("[mem - flags 0x]")
634 char sym[max(2*RSRC_BUF_SIZE + DECODED_BUF_SIZE, 640 char sym[max(2*RSRC_BUF_SIZE + DECODED_BUF_SIZE,
635 2*RSRC_BUF_SIZE + FLAG_BUF_SIZE + RAW_BUF_SIZE)]; 641 2*RSRC_BUF_SIZE + FLAG_BUF_SIZE + RAW_BUF_SIZE)];
@@ -651,6 +657,9 @@ static char *resource_string(char *buf, char *end, struct resource *res,
651 } else if (res->flags & IORESOURCE_DMA) { 657 } else if (res->flags & IORESOURCE_DMA) {
652 p = string(p, pend, "dma ", str_spec); 658 p = string(p, pend, "dma ", str_spec);
653 specp = &dec_spec; 659 specp = &dec_spec;
660 } else if (res->flags & IORESOURCE_BUS) {
661 p = string(p, pend, "bus ", str_spec);
662 specp = &bus_spec;
654 } else { 663 } else {
655 p = string(p, pend, "??? ", str_spec); 664 p = string(p, pend, "??? ", str_spec);
656 specp = &mem_spec; 665 specp = &mem_spec;
@@ -666,6 +675,8 @@ static char *resource_string(char *buf, char *end, struct resource *res,
666 p = string(p, pend, " 64bit", str_spec); 675 p = string(p, pend, " 64bit", str_spec);
667 if (res->flags & IORESOURCE_PREFETCH) 676 if (res->flags & IORESOURCE_PREFETCH)
668 p = string(p, pend, " pref", str_spec); 677 p = string(p, pend, " pref", str_spec);
678 if (res->flags & IORESOURCE_WINDOW)
679 p = string(p, pend, " window", str_spec);
669 if (res->flags & IORESOURCE_DISABLED) 680 if (res->flags & IORESOURCE_DISABLED)
670 p = string(p, pend, " disabled", str_spec); 681 p = string(p, pend, " disabled", str_spec);
671 } else { 682 } else {
diff --git a/lib/zlib_inflate/inffast.c b/lib/zlib_inflate/inffast.c
index 215447c55261..2c13ecc5bb2c 100644
--- a/lib/zlib_inflate/inffast.c
+++ b/lib/zlib_inflate/inffast.c
@@ -8,21 +8,6 @@
8#include "inflate.h" 8#include "inflate.h"
9#include "inffast.h" 9#include "inffast.h"
10 10
11/* Only do the unaligned "Faster" variant when
12 * CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is set
13 *
14 * On powerpc, it won't be as we don't include autoconf.h
15 * automatically for the boot wrapper, which is intended as
16 * we run in an environment where we may not be able to deal
17 * with (even rare) alignment faults. In addition, we do not
18 * define __KERNEL__ for arch/powerpc/boot unlike x86
19 */
20
21#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
22#include <asm/unaligned.h>
23#include <asm/byteorder.h>
24#endif
25
26#ifndef ASMINF 11#ifndef ASMINF
27 12
28/* Allow machine dependent optimization for post-increment or pre-increment. 13/* Allow machine dependent optimization for post-increment or pre-increment.
@@ -36,14 +21,31 @@
36 - Pentium III (Anderson) 21 - Pentium III (Anderson)
37 - M68060 (Nikl) 22 - M68060 (Nikl)
38 */ 23 */
24union uu {
25 unsigned short us;
26 unsigned char b[2];
27};
28
29/* Endian independed version */
30static inline unsigned short
31get_unaligned16(const unsigned short *p)
32{
33 union uu mm;
34 unsigned char *b = (unsigned char *)p;
35
36 mm.b[0] = b[0];
37 mm.b[1] = b[1];
38 return mm.us;
39}
40
39#ifdef POSTINC 41#ifdef POSTINC
40# define OFF 0 42# define OFF 0
41# define PUP(a) *(a)++ 43# define PUP(a) *(a)++
42# define UP_UNALIGNED(a) get_unaligned((a)++) 44# define UP_UNALIGNED(a) get_unaligned16((a)++)
43#else 45#else
44# define OFF 1 46# define OFF 1
45# define PUP(a) *++(a) 47# define PUP(a) *++(a)
46# define UP_UNALIGNED(a) get_unaligned(++(a)) 48# define UP_UNALIGNED(a) get_unaligned16(++(a))
47#endif 49#endif
48 50
49/* 51/*
@@ -256,7 +258,6 @@ void inflate_fast(z_streamp strm, unsigned start)
256 } 258 }
257 } 259 }
258 else { 260 else {
259#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
260 unsigned short *sout; 261 unsigned short *sout;
261 unsigned long loops; 262 unsigned long loops;
262 263
@@ -274,22 +275,25 @@ void inflate_fast(z_streamp strm, unsigned start)
274 sfrom = (unsigned short *)(from - OFF); 275 sfrom = (unsigned short *)(from - OFF);
275 loops = len >> 1; 276 loops = len >> 1;
276 do 277 do
278#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
279 PUP(sout) = PUP(sfrom);
280#else
277 PUP(sout) = UP_UNALIGNED(sfrom); 281 PUP(sout) = UP_UNALIGNED(sfrom);
282#endif
278 while (--loops); 283 while (--loops);
279 out = (unsigned char *)sout + OFF; 284 out = (unsigned char *)sout + OFF;
280 from = (unsigned char *)sfrom + OFF; 285 from = (unsigned char *)sfrom + OFF;
281 } else { /* dist == 1 or dist == 2 */ 286 } else { /* dist == 1 or dist == 2 */
282 unsigned short pat16; 287 unsigned short pat16;
283 288
284 pat16 = *(sout-2+2*OFF); 289 pat16 = *(sout-1+OFF);
285 if (dist == 1) 290 if (dist == 1) {
286#if defined(__BIG_ENDIAN) 291 union uu mm;
287 pat16 = (pat16 & 0xff) | ((pat16 & 0xff) << 8); 292 /* copy one char pattern to both bytes */
288#elif defined(__LITTLE_ENDIAN) 293 mm.us = pat16;
289 pat16 = (pat16 & 0xff00) | ((pat16 & 0xff00) >> 8); 294 mm.b[0] = mm.b[1];
290#else 295 pat16 = mm.us;
291#error __BIG_ENDIAN nor __LITTLE_ENDIAN is defined 296 }
292#endif
293 loops = len >> 1; 297 loops = len >> 1;
294 do 298 do
295 PUP(sout) = pat16; 299 PUP(sout) = pat16;
@@ -298,20 +302,6 @@ void inflate_fast(z_streamp strm, unsigned start)
298 } 302 }
299 if (len & 1) 303 if (len & 1)
300 PUP(out) = PUP(from); 304 PUP(out) = PUP(from);
301#else /* CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS */
302 from = out - dist; /* copy direct from output */
303 do { /* minimum length is three */
304 PUP(out) = PUP(from);
305 PUP(out) = PUP(from);
306 PUP(out) = PUP(from);
307 len -= 3;
308 } while (len > 2);
309 if (len) {
310 PUP(out) = PUP(from);
311 if (len > 1)
312 PUP(out) = PUP(from);
313 }
314#endif /* !CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS */
315 } 305 }
316 } 306 }
317 else if ((op & 64) == 0) { /* 2nd level distance code */ 307 else if ((op & 64) == 0) { /* 2nd level distance code */