rpi: code cleanup, minor fixes