diff options
author | Sam Ravnborg <sam@ravnborg.org> | 2009-01-06 15:51:26 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-06 15:51:26 -0500 |
commit | ff9aefbf4dab2c631a90f0319dfb316c6769d5a4 (patch) | |
tree | 190ec7c9ac28ac4bd47c56cece14d085755a63aa /arch/sparc | |
parent | 2eac5a0d3a84acd267ff7aac5b45c020bfcb158c (diff) |
sparc64: refactor code in init_64.c
The sparc64 allmodconfig build broke due to enabling of the
branch_tracer that does some very clever things with
all if conditions. This caused my gcc 3.4.5 to be so confused that
it emitted two warnings:
arch/sparc/mm/init_64.c: In function `update_mmu_cache':
arch/sparc/mm/init_64.c:271: warning: 'pg_flags' might be used uninitialized in this function
arch/sparc/mm/init_64.c:272: warning: 'page' might be used uninitialized in this function
And with -Werror this broke the build.
Refactor code so it:
1) becomes more readable
2) no longer emit a warning with the branch_tracer enabled
The refactoring uses a small helper function (flush_dcache()).
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/mm/init_64.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 6ea73da29312..6ffc7e911d50 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c | |||
@@ -258,21 +258,16 @@ static inline void tsb_insert(struct tsb *ent, unsigned long tag, unsigned long | |||
258 | unsigned long _PAGE_ALL_SZ_BITS __read_mostly; | 258 | unsigned long _PAGE_ALL_SZ_BITS __read_mostly; |
259 | unsigned long _PAGE_SZBITS __read_mostly; | 259 | unsigned long _PAGE_SZBITS __read_mostly; |
260 | 260 | ||
261 | void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte) | 261 | static void flush_dcache(unsigned long pfn) |
262 | { | 262 | { |
263 | struct mm_struct *mm; | 263 | struct page *page; |
264 | struct tsb *tsb; | ||
265 | unsigned long tag, flags; | ||
266 | unsigned long tsb_index, tsb_hash_shift; | ||
267 | 264 | ||
268 | if (tlb_type != hypervisor) { | 265 | page = pfn_to_page(pfn); |
269 | unsigned long pfn = pte_pfn(pte); | 266 | if (page && page_mapping(page)) { |
270 | unsigned long pg_flags; | 267 | unsigned long pg_flags; |
271 | struct page *page; | ||
272 | 268 | ||
273 | if (pfn_valid(pfn) && | 269 | pg_flags = page->flags; |
274 | (page = pfn_to_page(pfn), page_mapping(page)) && | 270 | if (pg_flags & (1UL << PG_dcache_dirty)) { |
275 | ((pg_flags = page->flags) & (1UL << PG_dcache_dirty))) { | ||
276 | int cpu = ((pg_flags >> PG_dcache_cpu_shift) & | 271 | int cpu = ((pg_flags >> PG_dcache_cpu_shift) & |
277 | PG_dcache_cpu_mask); | 272 | PG_dcache_cpu_mask); |
278 | int this_cpu = get_cpu(); | 273 | int this_cpu = get_cpu(); |
@@ -290,6 +285,21 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t p | |||
290 | put_cpu(); | 285 | put_cpu(); |
291 | } | 286 | } |
292 | } | 287 | } |
288 | } | ||
289 | |||
290 | void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte) | ||
291 | { | ||
292 | struct mm_struct *mm; | ||
293 | struct tsb *tsb; | ||
294 | unsigned long tag, flags; | ||
295 | unsigned long tsb_index, tsb_hash_shift; | ||
296 | |||
297 | if (tlb_type != hypervisor) { | ||
298 | unsigned long pfn = pte_pfn(pte); | ||
299 | |||
300 | if (pfn_valid(pfn)) | ||
301 | flush_dcache(pfn); | ||
302 | } | ||
293 | 303 | ||
294 | mm = vma->vm_mm; | 304 | mm = vma->vm_mm; |
295 | 305 | ||