usbblaster_spi.c: Refactor singleton states into reentrant pattern

Move global singleton states into a struct and store within
the spi_master data field for the life-time of the driver.

This is one of the steps on the way to move spi_master data
memory management behind the initialisation API, for more
context see other patches under the same topic "register_master_api".

This patch also introduces shutdown function for usbblaster, because
there was none previously and without shutdown function there is no
way to free spi_master data at the end of driver lifecycle.


Change-Id: Ia81f9f40c7eab430a8b304d0b197ce7c75bf5ace
Signed-off-by: Anastasia Klimchuk <>
Tested-by: build bot (Jenkins) <>
Reviewed-by: Edward O'Callaghan <>
Reviewed-by: Angel Pons <>
1 file changed