diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2009-11-30 08:38:43 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-11 06:34:09 -0500 |
commit | c4caa778157dbbf04116f0ac2111e389b5cd7a29 (patch) | |
tree | d8e26c07bacaaa6b1e6b1e57816fd42da94e15f4 /arch/sparc | |
parent | 0ec62d290912bb4b989be7563851bc364ec73b56 (diff) |
file ->get_unmapped_area() shouldn't duplicate work of get_unmapped_area()
... we should call mm ->get_unmapped_area() instead and let our caller
do the final checks.
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/kernel/sys_sparc_64.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c index ddda12fcbac2..d498b32c75f6 100644 --- a/arch/sparc/kernel/sys_sparc_64.c +++ b/arch/sparc/kernel/sys_sparc_64.c | |||
@@ -317,10 +317,14 @@ bottomup: | |||
317 | unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, unsigned long len, unsigned long pgoff, unsigned long flags) | 317 | unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, unsigned long len, unsigned long pgoff, unsigned long flags) |
318 | { | 318 | { |
319 | unsigned long align_goal, addr = -ENOMEM; | 319 | unsigned long align_goal, addr = -ENOMEM; |
320 | unsigned long (*get_area)(struct file *, unsigned long, | ||
321 | unsigned long, unsigned long, unsigned long); | ||
322 | |||
323 | get_area = current->mm->get_unmapped_area; | ||
320 | 324 | ||
321 | if (flags & MAP_FIXED) { | 325 | if (flags & MAP_FIXED) { |
322 | /* Ok, don't mess with it. */ | 326 | /* Ok, don't mess with it. */ |
323 | return get_unmapped_area(NULL, orig_addr, len, pgoff, flags); | 327 | return get_area(NULL, orig_addr, len, pgoff, flags); |
324 | } | 328 | } |
325 | flags &= ~MAP_SHARED; | 329 | flags &= ~MAP_SHARED; |
326 | 330 | ||
@@ -333,7 +337,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u | |||
333 | align_goal = (64UL * 1024); | 337 | align_goal = (64UL * 1024); |
334 | 338 | ||
335 | do { | 339 | do { |
336 | addr = get_unmapped_area(NULL, orig_addr, len + (align_goal - PAGE_SIZE), pgoff, flags); | 340 | addr = get_area(NULL, orig_addr, len + (align_goal - PAGE_SIZE), pgoff, flags); |
337 | if (!(addr & ~PAGE_MASK)) { | 341 | if (!(addr & ~PAGE_MASK)) { |
338 | addr = (addr + (align_goal - 1UL)) & ~(align_goal - 1UL); | 342 | addr = (addr + (align_goal - 1UL)) & ~(align_goal - 1UL); |
339 | break; | 343 | break; |
@@ -351,7 +355,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u | |||
351 | * be obtained. | 355 | * be obtained. |
352 | */ | 356 | */ |
353 | if (addr & ~PAGE_MASK) | 357 | if (addr & ~PAGE_MASK) |
354 | addr = get_unmapped_area(NULL, orig_addr, len, pgoff, flags); | 358 | addr = get_area(NULL, orig_addr, len, pgoff, flags); |
355 | 359 | ||
356 | return addr; | 360 | return addr; |
357 | } | 361 | } |