x86:aperture_64: code pattern clean
PATCH 2/3 x86:aperture_64: code pattern clean
This patch don't change code function,
it just do prepare for import thememblock_alloc_in_range to do the code pattern
which looks like below in one function:
memblock_find_in_range()
follow bymemblock_reserve()
Signed-off-by Wang YanQing <[email protected]>
--- arch/x86/kernel/aperture_64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/aperture_64.c +2 -2
@@ -85,9 +85,9 @@ static u32 __init allocate_aperture(void)* memory. Unfortunately we cannot move it up because that would * make the IOMMU useless. */ - addr =memblock_find_in_range (GART_MIN_ADDR ,GART_MAX_ADDR , + addr =memblock_find_in_range (GART_MIN_ADDR ,GART_MAX_ADDR - aper_size, aper_size, aper_size); -if (!addr || addr + aper_size >GART_MAX_ADDR ) { +if (!addr) {printk (KERN_ERR "Cannot allocate aperture memory hole (%lx,%uK)\n" , addr, aper_size>>10 );
Signature · 1 line
1.7.12.4.dirty
Quoted 20 lines · Wang YanQing
This patch don't change code function,
it just do prepare for import thememblock_alloc_in_rangeto do the code pattern
which looks like below in one function:
memblock_find_in_range()
follow bymemblock_reserve()Signed-off-by Wang YanQing <[email protected]>--- arch/x86/kernel/aperture_64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/kernel/aperture_64.c +0
-0
arch/x86/kernel/aperture_64.c static u32 __init allocate_aperture(void) · line 88
Quoted 5 lines
arch/x86/kernel/aperture_64.c +1
-1@@ -85,9 +85,9 @@ static u32 __init allocate_aperture(void)* memory. Unfortunately we cannot move it up because that would * make the IOMMU useless. */ - addr = memblock_find_in_range(GART_MIN_ADDR, GART_MAX_ADDR, + addr = memblock_find_in_range(GART_MIN_ADDR, GART_MAX_ADDR - aper_size,
this change is wrong.
arch/x86/kernel/aperture_64.c static u32 __init allocate_aperture(void) · line 90
Quoted 3 lines
arch/x86/kernel/aperture_64.c +1
-1aper_size, aper_size); -if (!addr || addr + aper_size >GART_MAX_ADDR ) { +if (!addr) {
could just drop not needed checking of
addr + aper_size > GART_MAX_ADDR
Thanks
Yinghai