spi: Refactoring and cleanups.