]> bbs.cooldavid.org Git - net-next-2.6.git/commit
ARM: OMAP: Cleanup OMAP FB SDRAM reservation
authorRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 22 May 2010 22:53:45 +0000 (23:53 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 16 Jul 2010 10:06:41 +0000 (11:06 +0100)
commita1af0fbbbaac595b5bdf5495578d8ddbc6c17e6d
tree5bfc1ca15beece917020b3b598a90aafb93e42c5
parent98c672cf1fa2a56f6f43e3f48b1208b83845582c
ARM: OMAP: Cleanup OMAP FB SDRAM reservation

The logic in this file is rather convoluted, but essentially:

1. region type 0 is SDRAM
2. referring to the code fragment
                if (set_fbmem_region_type(&rg, OMAPFB_MEMTYPE_SDRAM,
                                          sdram_start, sdram_size) < 0 ||
                    (rg.type != OMAPFB_MEMTYPE_SDRAM))
                        continue;
   - if rg.type is not OMAPFB_MEMTYPE_SDRAM, set_fbmem_region_type()
     returns zero immediately (since rg.type is non-zero), and so we
     'continue'.
   - if rg.type is OMAPFB_MEMTYPE_SDRAM, and rg.paddr is zero,
     we fall through.
   - if rg.type is OMAPFB_MEMTYPE_SDRAM, and the region lies within
     SDRAM, we fall through.
   - if rg.type is OMAPFB_MEMTYPE_SDRAM, and the region is not within
     SDRAM, we 'continue'.
3. check_fbmem_region seems unnecessary.
   - we know rg.type is OMAPFB_MEMTYPE_SDRAM
   - we can check rg.size independently
   - bootmem_reserve() can check for overlapping reservations itself
   - we've already validated that the requested region lies within SDRAM.
4. avoid BUG()ing if the region entry is already set; print an error,
   and mark the configuration invalid - at least we'll continue booting
   so the error message has a chance of being logged/visible via serial
   console.

With these changes in place, it makes the code much easier to understand
and hence easier to convert to LMB.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/plat-omap/fb.c