linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Borislav Petkov <bp@suse.de>, David Ahern <dsahern@gmail.com>,
	Don Zickus <dzickus@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>, Mike Galbraith <efault@gmx.de>,
	Namhyung Kim <namhyung@kernel.org>,
	Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Stephane Eranian <eranian@google.com>
Subject: [PATCH 07/18] tools: Move code originally from linux/log2.h to tools/include/linux/
Date: Tue, 16 Dec 2014 13:57:09 -0300	[thread overview]
Message-ID: <1418749040-31807-8-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1418749040-31807-1-git-send-email-acme@kernel.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

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

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-uqohgzilp3ebd3cbybnf3luc@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/include/linux/log2.h | 26 ++++++++++++++++++++++++++
 tools/perf/MANIFEST        |  3 ++-
 tools/perf/Makefile.perf   |  1 +
 tools/perf/util/evlist.c   |  1 +
 tools/perf/util/util.h     | 11 -----------
 5 files changed, 30 insertions(+), 12 deletions(-)
 create mode 100644 tools/include/linux/log2.h

diff --git a/tools/include/linux/log2.h b/tools/include/linux/log2.h
new file mode 100644
index 000000000000..141b7665d842
--- /dev/null
+++ b/tools/include/linux/log2.h
@@ -0,0 +1,26 @@
+/* Integer base 2 logarithm calculation
+ *
+ * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
+ * Written by David Howells (dhowells@redhat.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef _TOOLS_LINUX_LOG2_H
+#define _TOOLS_LINUX_LOG2_H
+
+/*
+ *  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));
+}
+
+#endif /* _TOOLS_LINUX_LOG2_H */
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index 39c08636357b..db7827fd2518 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -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
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index bfd86a32254a..bd6073e0dec7 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -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
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index ac808680e61c..8eb92cf5d552 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -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);
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 008b361b1758..25b22bbea066 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -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)
-- 
1.9.3


  parent reply	other threads:[~2014-12-16 16:58 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-16 16:57 [GIT PULL 00/18] perf/core improvements and fixes Arnaldo Carvalho de Melo
2014-12-16 16:57 ` [PATCH 01/18] perf evlist: Fixup brown paper bag on "hint" for --mmap-pages cmdline arg Arnaldo Carvalho de Melo
2014-12-16 16:57 ` [PATCH 02/18] perf evlist: Clarify sterror_mmap variable names Arnaldo Carvalho de Melo
2014-12-16 16:57 ` [PATCH 03/18] perf evlist: Improve the strerror_mmap method Arnaldo Carvalho de Melo
2014-12-16 16:57 ` [PATCH 04/18] perf trace: Let the perf_evlist__mmap autosize the number of pages to use Arnaldo Carvalho de Melo
2014-12-16 16:57 ` [PATCH 05/18] perf evlist: Do not use hard coded value for a mmap_pages default Arnaldo Carvalho de Melo
2014-12-17 13:23   ` Jiri Olsa
2014-12-17 14:00     ` Arnaldo Carvalho de Melo
2014-12-16 16:57 ` [PATCH 06/18] tools: Move __ffs implementation to tools/include/asm-generic/bitops/__ffs.h Arnaldo Carvalho de Melo
2014-12-17 13:27   ` Jiri Olsa
2014-12-16 16:57 ` Arnaldo Carvalho de Melo [this message]
2014-12-16 16:57 ` [PATCH 08/18] tools: Move code originally from asm-generic/atomic.h into tools/include/asm-generic/ Arnaldo Carvalho de Melo
2014-12-16 16:57 ` [PATCH 09/18] tools: Whitespace prep patches for moving bitops.h Arnaldo Carvalho de Melo
2014-12-16 16:57 ` [PATCH 10/18] tools lib: Move asm-generic/bitops/find.h code to tools/include and tools/lib Arnaldo Carvalho de Melo
2014-12-17 13:41   ` Jiri Olsa
2014-12-17 14:04     ` Arnaldo Carvalho de Melo
2014-12-17 13:42   ` Jiri Olsa
2014-12-17 14:02     ` Arnaldo Carvalho de Melo
2014-12-17 14:48       ` Arnaldo Carvalho de Melo
2014-12-16 16:57 ` [PATCH 11/18] tools: Introduce asm-generic/bitops.h Arnaldo Carvalho de Melo
2014-12-16 16:57 ` [PATCH 12/18] tools: Move bitops.h from tools/perf/util to tools/ Arnaldo Carvalho de Melo
2014-12-16 16:57 ` [PATCH 13/18] tools: Adopt fls_long and deps Arnaldo Carvalho de Melo
2014-12-16 16:57 ` [PATCH 14/18] tools: Adopt rounddown_pow_of_two " Arnaldo Carvalho de Melo
2014-12-16 16:57 ` [PATCH 15/18] perf tools: Make the mmap length autotuning more robust Arnaldo Carvalho de Melo
2014-12-17 13:48   ` Jiri Olsa
2014-12-16 16:57 ` [PATCH 16/18] tools: Adopt roundup_pow_of_two Arnaldo Carvalho de Melo
2014-12-16 16:57 ` [PATCH 17/18] perf evlist: Use roundup_pow_of_two Arnaldo Carvalho de Melo
2014-12-16 16:57 ` [PATCH 18/18] perf symbols: Fix use after free in filename__read_build_id Arnaldo Carvalho de Melo
2014-12-17 14:50 ` [GIT PULL 00/18] perf/core improvements and fixes Arnaldo Carvalho de Melo
2014-12-18  6:24   ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1418749040-31807-8-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=bp@suse.de \
    --cc=dsahern@gmail.com \
    --cc=dzickus@redhat.com \
    --cc=efault@gmx.de \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).