Un-nest nested functions

This is for compatibility with clang

Change-Id: I06944f90c479f12f648052c08a3e255545ebbf02
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>