Name

spi_sync — blocking/synchronous SPI data transfers

Synopsis

int spi_sync (struct spi_device *  spi,
 struct spi_message *  message);

Arguments

spi

device with which data will be exchanged

message

describes the data transfers

Context

can sleep

Description

This call may only be used from a context that may sleep. The sleep is non-interruptible, and has no timeout. Low-overhead controller drivers may DMA directly into and out of the message buffers.

Note that the SPI device's chip select is active during the message, and then is normally disabled between messages. Drivers for some frequently-used devices may want to minimize costs of selecting a chip, by leaving it selected in anticipation that the next message will go to the same chip. (That may increase power usage.)

Also, the caller is guaranteeing that the memory associated with the message will not be freed before this call returns.

The return value is a negative error code if the message could not be submitted, else zero. When the value is zero, then message->status is also defined; it's the completion code for the transfer, either zero or a negative error code from the controller driver.