Cleanup eeprom reading code.
[linux-2.6/linux-mips.git] / include / asm-generic / pgtable.h
blobb98102522d0d03c386b2d27550ddbaff9064b578
1 #ifndef _ASM_GENERIC_PGTABLE_H
2 #define _ASM_GENERIC_PGTABLE_H
4 static inline int ptep_test_and_clear_young(pte_t *ptep)
6 pte_t pte = *ptep;
7 if (!pte_young(pte))
8 return 0;
9 set_pte(ptep, pte_mkold(pte));
10 return 1;
13 static inline int ptep_test_and_clear_dirty(pte_t *ptep)
15 pte_t pte = *ptep;
16 if (!pte_dirty(pte))
17 return 0;
18 set_pte(ptep, pte_mkclean(pte));
19 return 1;
22 static inline pte_t ptep_get_and_clear(pte_t *ptep)
24 pte_t pte = *ptep;
25 pte_clear(ptep);
26 return pte;
29 static inline void ptep_set_wrprotect(pte_t *ptep)
31 pte_t old_pte = *ptep;
32 set_pte(ptep, pte_wrprotect(old_pte));
35 static inline void ptep_mkdirty(pte_t *ptep)
37 pte_t old_pte = *ptep;
38 set_pte(ptep, pte_mkdirty(old_pte));
41 #define pte_same(A,B) (pte_val(A) == pte_val(B))
43 #endif /* _ASM_GENERIC_PGTABLE_H */