Patch based on work by Dengke Du <dengke.du@windriver.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>