mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-27 03:47:43 +00:00
38f3323037
This reverts commit 39d61db0ed
.
The commit was buggy in multiple ways:
- the conversion to ilog2() was incorrect to begin with
- it tested the wrong #defines, so on all architectures but FRV you'd
never see the bug except for constant arguments.
- the new "get_order()" macro used its arguments multiple times, and
didn't even parenthesize them properly
- despite the comments, it was not true that you could use it for
constant initializers, since not all architectures even use the
generic page.h header file.
All of the problems are individually fixable, but it all boils down to:
better just revert it, and re-do it from scratch.
Cc: David Howells <dhowells@redhat.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
27 lines
452 B
C
27 lines
452 B
C
#ifndef _ASM_GENERIC_PAGE_H
|
|
#define _ASM_GENERIC_PAGE_H
|
|
|
|
#ifdef __KERNEL__
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#include <linux/compiler.h>
|
|
|
|
/* Pure 2^n version of get_order */
|
|
static __inline__ __attribute_const__ int get_order(unsigned long size)
|
|
{
|
|
int order;
|
|
|
|
size = (size - 1) >> (PAGE_SHIFT - 1);
|
|
order = -1;
|
|
do {
|
|
size >>= 1;
|
|
order++;
|
|
} while (size);
|
|
return order;
|
|
}
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
#endif /* __KERNEL__ */
|
|
|
|
#endif /* _ASM_GENERIC_PAGE_H */
|