[PATCH 3/3] mm/slub: Put tid_to_cpu() and tid_to_event() inside #ifdef block

From: Matthias Kaehlcke
Date: Fri May 19 2017 - 17:01:38 EST


The functions are only used when certain config options are set. Putting
them inside #ifdef fixes the following warnings when building with clang:

mm/slub.c:1759:28: error: unused function 'tid_to_cpu'
[-Werror,-Wunused-function]
^
mm/slub.c:1764:29: error: unused function 'tid_to_event'
[-Werror,-Wunused-function]

Signed-off-by: Matthias Kaehlcke <mka@xxxxxxxxxxxx>
---
mm/slub.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/mm/slub.c b/mm/slub.c
index 23a8eb83efff..6df95738420d 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1945,15 +1945,19 @@ static inline unsigned long next_tid(unsigned long tid)
return tid + TID_STEP;
}

+#ifdef SLUB_DEBUG_CMPXCHG
+#ifdef CONFIG_PREEMPT
static inline unsigned int tid_to_cpu(unsigned long tid)
{
return tid % TID_STEP;
}
+#endif

static inline unsigned long tid_to_event(unsigned long tid)
{
return tid / TID_STEP;
}
+#endif

static inline unsigned int init_tid(int cpu)
{
--
2.13.0.303.g4ebf302169-goog