Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd4fd5aa authored by Stephen Rothwell's avatar Stephen Rothwell Committed by Linus Torvalds
Browse files

[PATCH] mm: consolidate get_order



Someone mentioned that almost all the architectures used basically the same
implementation of get_order.  This patch consolidates them into
asm-generic/page.h and includes that in the appropriate places.  The
exceptions are ia64 and ppc which have their own (presumably optimised)
versions.

Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 28ae55c9
Loading
Loading
Loading
Loading
+2 −14
Original line number Diff line number Diff line
@@ -63,20 +63,6 @@ typedef unsigned long pgprot_t;

#endif /* STRICT_MM_TYPECHECKS */

/* Pure 2^n version of get_order */
extern __inline__ int get_order(unsigned long size)
{
	int order;

	size = (size-1) >> (PAGE_SHIFT-1);
	order = -1;
	do {
		size >>= 1;
		order++;
	} while (size);
	return order;
}

#ifdef USE_48_BIT_KSEG
#define PAGE_OFFSET		0xffff800000000000UL
#else
@@ -112,4 +98,6 @@ extern __inline__ int get_order(unsigned long size)

#endif /* __KERNEL__ */

#include <asm-generic/page.h>

#endif /* _ALPHA_PAGE_H */
+2 −14
Original line number Diff line number Diff line
@@ -163,20 +163,6 @@ typedef unsigned long pgprot_t;
/* the upper-most page table pointer */
extern pmd_t *top_pmd;

/* Pure 2^n version of get_order */
static inline int get_order(unsigned long size)
{
	int order;

	size = (size-1) >> (PAGE_SHIFT-1);
	order = -1;
	do {
		size >>= 1;
		order++;
	} while (size);
	return order;
}

#include <asm/memory.h>

#endif /* !__ASSEMBLY__ */
@@ -186,4 +172,6 @@ static inline int get_order(unsigned long size)

#endif /* __KERNEL__ */

#include <asm-generic/page.h>

#endif
+2 −14
Original line number Diff line number Diff line
@@ -89,20 +89,6 @@ typedef unsigned long pgprot_t;
#ifdef __KERNEL__
#ifndef __ASSEMBLY__

/* Pure 2^n version of get_order */
static inline int get_order(unsigned long size)
{
	int order;

	size = (size-1) >> (PAGE_SHIFT-1);
	order = -1;
	do {
		size >>= 1;
		order++;
	} while (size);
	return order;
}

#include <asm/memory.h>

#endif /* !__ASSEMBLY__ */
@@ -112,4 +98,6 @@ static inline int get_order(unsigned long size)

#endif /* __KERNEL__ */

#include <asm-generic/page.h>

#endif
+2 −13
Original line number Diff line number Diff line
@@ -70,19 +70,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;

#ifndef __ASSEMBLY__

/* Pure 2^n version of get_order */
static inline 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__ */

#define VM_DATA_DEFAULT_FLAGS	(VM_READ | VM_WRITE | VM_EXEC | \
@@ -90,5 +77,7 @@ static inline int get_order(unsigned long size)

#endif /* __KERNEL__ */

#include <asm-generic/page.h>

#endif /* _CRIS_PAGE_H */
+2 −15
Original line number Diff line number Diff line
@@ -45,21 +45,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
/* to align the pointer to the (next) page boundary */
#define PAGE_ALIGN(addr)	(((addr) + PAGE_SIZE - 1) & PAGE_MASK)

/* Pure 2^n version of get_order */
static inline int get_order(unsigned long size) __attribute_const__;
static inline int get_order(unsigned long size)
{
	int order;

	size = (size - 1) >> (PAGE_SHIFT - 1);
	order = -1;
	do {
		size >>= 1;
		order++;
	} while (size);
	return order;
}

#define devmem_is_allowed(pfn)	1

#define __pa(vaddr)		virt_to_phys((void *) vaddr)
@@ -102,4 +87,6 @@ extern unsigned long max_pfn;
#define WANT_PAGE_VIRTUAL	1
#endif

#include <asm-generic/page.h>

#endif /* _ASM_PAGE_H */
Loading