aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRajesh Venkatasubramanian <vrajesh@umich.edu>2004-08-22 22:57:07 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-08-22 22:57:07 -0700
commit86de37f0de2be6b0c51c0210dd6533177353f864 (patch)
treeb0b20494f4b84df74d8ef79c7ec1d40b1e907566 /arch
parente66c6753333b9c2b1cf5daf0b73814b5fdb09c41 (diff)
downloadhistory-86de37f0de2be6b0c51c0210dd6533177353f864.tar.gz
[PATCH] prio_tree: iterator + vma_prio_tree_next cleanup
Currently we have: while ((vma = vma_prio_tree_next(vma, root, &iter, begin, end)) != NULL) do_something_with(vma); Then iter,root,begin,end are all transfered unchanged to various functions. This patch hides them in struct iter instead. It slightly lessens source, code size, and stack usage. Patch compiles and tested lightly. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Signed-off-by: Rajesh Venkatasubramanian <vrajesh@umich.edu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mm/fault-armv.c10
-rw-r--r--arch/parisc/kernel/cache.c5
2 files changed, 6 insertions, 9 deletions
diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c
index d03940c1b6970c..b6225a35fea460 100644
--- a/arch/arm/mm/fault-armv.c
+++ b/arch/arm/mm/fault-armv.c
@@ -80,7 +80,7 @@ static void __flush_dcache_page(struct page *page)
{
struct address_space *mapping = page_mapping(page);
struct mm_struct *mm = current->active_mm;
- struct vm_area_struct *mpnt = NULL;
+ struct vm_area_struct *mpnt;
struct prio_tree_iter iter;
unsigned long offset;
pgoff_t pgoff;
@@ -97,8 +97,7 @@ static void __flush_dcache_page(struct page *page)
pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
flush_dcache_mmap_lock(mapping);
- while ((mpnt = vma_prio_tree_next(mpnt, &mapping->i_mmap,
- &iter, pgoff, pgoff)) != NULL) {
+ vma_prio_tree_foreach(mpnt, &iter, &mapping->i_mmap, pgoff, pgoff) {
/*
* If this VMA is not in our MM, we can ignore it.
*/
@@ -128,7 +127,7 @@ make_coherent(struct vm_area_struct *vma, unsigned long addr, struct page *page,
{
struct address_space *mapping = page_mapping(page);
struct mm_struct *mm = vma->vm_mm;
- struct vm_area_struct *mpnt = NULL;
+ struct vm_area_struct *mpnt;
struct prio_tree_iter iter;
unsigned long offset;
pgoff_t pgoff;
@@ -145,8 +144,7 @@ make_coherent(struct vm_area_struct *vma, unsigned long addr, struct page *page,
* cache coherency.
*/
flush_dcache_mmap_lock(mapping);
- while ((mpnt = vma_prio_tree_next(mpnt, &mapping->i_mmap,
- &iter, pgoff, pgoff)) != NULL) {
+ vma_prio_tree_foreach(mpnt, &iter, &mapping->i_mmap, pgoff, pgoff) {
/*
* If this VMA is not in our MM, we can ignore it.
* Note that we intentionally mask out the VMA
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
index eadc88c5a3d8a7..0703ab036826fa 100644
--- a/arch/parisc/kernel/cache.c
+++ b/arch/parisc/kernel/cache.c
@@ -245,7 +245,7 @@ void disable_sr_hashing(void)
void flush_dcache_page(struct page *page)
{
struct address_space *mapping = page_mapping(page);
- struct vm_area_struct *mpnt = NULL;
+ struct vm_area_struct *mpnt;
struct prio_tree_iter iter;
unsigned long offset;
unsigned long addr;
@@ -272,8 +272,7 @@ void flush_dcache_page(struct page *page)
* to flush one address here for them all to become coherent */
flush_dcache_mmap_lock(mapping);
- while ((mpnt = vma_prio_tree_next(mpnt, &mapping->i_mmap,
- &iter, pgoff, pgoff)) != NULL) {
+ vma_prio_tree_foreach(mpnt, &iter, &mapping->i_mmap, pgoff, pgoff) {
offset = (pgoff - mpnt->vm_pgoff) << PAGE_SHIFT;
addr = mpnt->vm_start + offset;