second round of locomo fixes

From
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-March/012183.html
Refactored for 3.18-rc4

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>