Skip to content

Commit 7f1e2fc

Browse files
Dawei Listffrdhrn
authored andcommitted
openrisc: Use asm-generic's version of fix_to_virt() & virt_to_fix()
Openrisc's implementation of fix_to_virt() & virt_to_fix() share same functionality with ones of asm generic. Plus, generic version of fix_to_virt() can trap invalid index at compile time. Thus, Replace the arch-specific implementations with asm generic's ones. Signed-off-by: Dawei Li <[email protected]> Signed-off-by: Stafford Horne <[email protected]>
1 parent 7b432bf commit 7f1e2fc

File tree

1 file changed

+1
-30
lines changed

1 file changed

+1
-30
lines changed

arch/openrisc/include/asm/fixmap.h

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -50,35 +50,6 @@ enum fixed_addresses {
5050
/* FIXADDR_BOTTOM might be a better name here... */
5151
#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
5252

53-
#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
54-
#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
55-
56-
/*
57-
* 'index to address' translation. If anyone tries to use the idx
58-
* directly without tranlation, we catch the bug with a NULL-deference
59-
* kernel oops. Illegal ranges of incoming indices are caught too.
60-
*/
61-
static __always_inline unsigned long fix_to_virt(const unsigned int idx)
62-
{
63-
/*
64-
* this branch gets completely eliminated after inlining,
65-
* except when someone tries to use fixaddr indices in an
66-
* illegal way. (such as mixing up address types or using
67-
* out-of-range indices).
68-
*
69-
* If it doesn't get removed, the linker will complain
70-
* loudly with a reasonably clear error message..
71-
*/
72-
if (idx >= __end_of_fixed_addresses)
73-
BUG();
74-
75-
return __fix_to_virt(idx);
76-
}
77-
78-
static inline unsigned long virt_to_fix(const unsigned long vaddr)
79-
{
80-
BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
81-
return __virt_to_fix(vaddr);
82-
}
53+
#include <asm-generic/fixmap.h>
8354

8455
#endif

0 commit comments

Comments
 (0)