/* It returns zero on success, else a negative error code.  */
int spi_sync(struct spi_device *spi, struct spi_message *message)
/* It returns zero on success, else a negative error code.  */
int spi_sync(struct spi_device *spi, struct spi_message *message)
{
	DECLARE_COMPLETION_ONSTACK(done);
	int status;
	message->complete = spi_complete;
	message->context = &done;
	status = spi_async(spi, message);
	if (status == 0) {
		wait_for_completion(&done);
		status = message->status;
	}
	message->context = NULL;
	return status;
}