Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools: Fix math.h breakage

Commit 98e1385ef24b ("include/linux/radix-tree.h: replace kernel.h with
the necessary inclusions") broke the radix tree test suite in two
different ways; first by including math.h which didn't exist in the
tools directory, and second by removing an implicit include of
spinlock.h before lockdep.h. Fix both issues.

Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Matthew Wilcox (Oracle) and committed by
Linus Torvalds
d6e6a27d ddca5b0e

+29 -21
+1 -21
tools/include/linux/kernel.h
··· 7 7 #include <assert.h> 8 8 #include <linux/build_bug.h> 9 9 #include <linux/compiler.h> 10 + #include <linux/math.h> 10 11 #include <endian.h> 11 12 #include <byteswap.h> 12 13 13 14 #ifndef UINT_MAX 14 15 #define UINT_MAX (~0U) 15 16 #endif 16 - 17 - #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) 18 17 19 18 #define PERF_ALIGN(x, a) __PERF_ALIGN_MASK(x, (typeof(x))(a)-1) 20 19 #define __PERF_ALIGN_MASK(x, mask) (((x)+(mask))&~(mask)) ··· 49 50 typeof(y) _min2 = (y); \ 50 51 (void) (&_min1 == &_min2); \ 51 52 _min1 < _min2 ? _min1 : _min2; }) 52 - #endif 53 - 54 - #ifndef roundup 55 - #define roundup(x, y) ( \ 56 - { \ 57 - const typeof(y) __y = y; \ 58 - (((x) + (__y - 1)) / __y) * __y; \ 59 - } \ 60 - ) 61 53 #endif 62 54 63 55 #ifndef BUG_ON ··· 93 103 int scnprintf_pad(char * buf, size_t size, const char * fmt, ...); 94 104 95 105 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) 96 - 97 - /* 98 - * This looks more complex than it should be. But we need to 99 - * get the type for the ~ right in round_down (it needs to be 100 - * as wide as the result!), and we want to evaluate the macro 101 - * arguments just once each. 102 - */ 103 - #define __round_mask(x, y) ((__typeof__(x))((y)-1)) 104 - #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) 105 - #define round_down(x, y) ((x) & ~__round_mask(x, y)) 106 106 107 107 #define current_gfp_context(k) 0 108 108 #define synchronize_rcu()
+25
tools/include/linux/math.h
··· 1 + #ifndef _TOOLS_MATH_H 2 + #define _TOOLS_MATH_H 3 + 4 + /* 5 + * This looks more complex than it should be. But we need to 6 + * get the type for the ~ right in round_down (it needs to be 7 + * as wide as the result!), and we want to evaluate the macro 8 + * arguments just once each. 9 + */ 10 + #define __round_mask(x, y) ((__typeof__(x))((y)-1)) 11 + #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) 12 + #define round_down(x, y) ((x) & ~__round_mask(x, y)) 13 + 14 + #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) 15 + 16 + #ifndef roundup 17 + #define roundup(x, y) ( \ 18 + { \ 19 + const typeof(y) __y = y; \ 20 + (((x) + (__y - 1)) / __y) * __y; \ 21 + } \ 22 + ) 23 + #endif 24 + 25 + #endif
+3
tools/testing/radix-tree/linux/lockdep.h
··· 1 1 #ifndef _LINUX_LOCKDEP_H 2 2 #define _LINUX_LOCKDEP_H 3 + 4 + #include <linux/spinlock.h> 5 + 3 6 struct lock_class_key { 4 7 unsigned int a; 5 8 };