Skip to contentSkip to conversation

tools: Move code originally from linux/ log2.h to tools/include/linux/

tip:perf/urgent tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Dec 18, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw
Commit-ID:  0389cd1f5fda34c14941c37a39547d16af5d56e2
Gitweb:     http://git.kernel.org/tip/0389cd1f5fda34c14941c37a39547d16af5d56e2
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Mon, 15 Dec 2014 16:04:11 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 17 Dec 2014 11:09:41 -0300

tools: Move code originally from linux/log2.h to tools/include/linux/

Quoted 1 line

From tools/perf/util/include/linux, so that it becomes accessible to

other tools/.

Cc Adrian Hunter <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc David Ahern <[email protected]>
Cc Don Zickus <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 fs/no-block.c => tools/include/linux/log2.h | 21 ++++++++++++---------
 tools/perf/MANIFEST                         |  3 ++-
 tools/perf/Makefile.perf                    |  1 +
 tools/perf/util/evlist.c                    |  1 +
 tools/perf/util/util.h                      | 11 -----------
 5 files changed, 16 insertions(+), 21 deletions(-)
tools/include/linux/log2.h renamed from fs/no-block.c +12 -9
similarity index 51%
copy from fs/no-block.c
copy to tools/include/linux/log2.h
index 6e40e42..141b766 100644
@@ -1,4 +1,4 @@
-/* no-block.c: implementation of routines required for non-BLOCK configuration
+/* Integer base 2 logarithm calculation
  *
  * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
  * Written by David Howells ([email protected])
@@ -9,15 +9,18 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#include <linux/kernel.h>
-#include <linux/fs.h>
+#ifndef _TOOLS_LINUX_LOG2_H
+#define _TOOLS_LINUX_LOG2_H
 
-static int no_blkdev_open(struct inode * inode, struct file * filp)
+/*
+ *  Determine whether some value is a power of two, where zero is
+ * *not* considered a power of two.
+ */
+
+static inline __attribute__((const))
+bool is_power_of_2(unsigned long n)
 {
-	return -ENODEV;
+	return (n != 0 && ((n & (n - 1)) == 0));
 }
 
-const struct file_operations def_blk_fops = {
-	.open		= no_blkdev_open,
-	.llseek		= noop_llseek,
-};
+#endif /* _TOOLS_LINUX_LOG2_H */
tools/perf/MANIFEST +2 -1
index 39c0863..db7827f 100644
@@ -7,8 +7,9 @@ tools/lib/symbol/kallsyms.h
 tools/include/asm/bug.h
 tools/include/asm-generic/bitops/__ffs.h
 tools/include/linux/compiler.h
-tools/include/linux/hash.h
 tools/include/linux/export.h
+tools/include/linux/hash.h
+tools/include/linux/log2.h
 tools/include/linux/types.h
 include/linux/const.h
 include/linux/perf_event.h
tools/perf/Makefile.perf +1 -0
index dbf8ca6..ec2be64 100644
@@ -234,6 +234,7 @@ LIB_H += util/include/linux/bitmap.h
 LIB_H += util/include/linux/bitops.h
 LIB_H += ../include/asm-generic/bitops/__ffs.h
 LIB_H += ../include/linux/compiler.h
+LIB_H += ../include/linux/log2.h
 LIB_H += util/include/linux/const.h
 LIB_H += util/include/linux/ctype.h
 LIB_H += util/include/linux/kernel.h
tools/perf/util/evlist.c +1 -0
index ac80868..8eb92cf 100644
@@ -25,6 +25,7 @@
 
 #include <linux/bitops.h>
 #include <linux/hash.h>
+#include <linux/log2.h>
 
 static void perf_evlist__mmap_put(struct perf_evlist *evlist, int idx);
 static void __perf_evlist__munmap(struct perf_evlist *evlist, int idx);
tools/perf/util/util.h +0 -11
index 008b361..25b22bb 100644
@@ -269,17 +269,6 @@ void event_attr_init(struct perf_event_attr *attr);
 #define _STR(x) #x
 #define STR(x) _STR(x)
 
-/*
- *  Determine whether some value is a power of two, where zero is
- * *not* considered a power of two.
- */
-
-static inline __attribute__((const))
-bool is_power_of_2(unsigned long n)
-{
-	return (n != 0 && ((n & (n - 1)) == 0));
-}
-
 static inline unsigned next_pow2(unsigned x)
 {
 	if (!x)