spidev: Minor rework to spidev_transfer()

Gcc does a better job of inlining code if spidev_transfer() is
reworked slightly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2018-07-11 19:43:20 -04:00
parent 733506dfb2
commit 32a85edb16
1 changed files with 7 additions and 7 deletions

View File

@ -57,15 +57,15 @@ static void
spidev_transfer(struct spidev_s *spi, uint8_t receive_data spidev_transfer(struct spidev_s *spi, uint8_t receive_data
, uint8_t data_len, uint8_t *data) , uint8_t data_len, uint8_t *data)
{ {
if (spi->flags & SF_HAVE_PIN) { spi_prepare(spi->spi_config);
spi_prepare(spi->spi_config);
if (spi->flags & SF_HAVE_PIN)
gpio_out_write(spi->pin, 0); gpio_out_write(spi->pin, 0);
spi_transfer(spi->spi_config, receive_data, data_len, data);
spi_transfer(spi->spi_config, receive_data, data_len, data);
if (spi->flags & SF_HAVE_PIN)
gpio_out_write(spi->pin, 1); gpio_out_write(spi->pin, 1);
} else {
spi_prepare(spi->spi_config);
spi_transfer(spi->spi_config, receive_data, data_len, data);
}
} }
void void