Restructure the locking around SPI transfers