diff --git a/drivers/bluetooth/hci/spi.c b/drivers/bluetooth/hci/spi.c index d2148b9c9a0..9b37b0fb756 100644 --- a/drivers/bluetooth/hci/spi.c +++ b/drivers/bluetooth/hci/spi.c @@ -135,25 +135,28 @@ static struct spi_config spi_conf = { }; static struct spi_buf spi_tx_buf; static struct spi_buf spi_rx_buf; +static const struct spi_buf_set spi_tx = { + .buffers = &spi_tx_buf, + .count = 1 +}; +static const struct spi_buf_set spi_rx = { + .buffers = &spi_rx_buf, + .count = 1 +}; static inline int bt_spi_dev_configure(void) { - spi_conf.dev = spi_dev; return 0; } -static inline int bt_spi_transceive(const void *tx, u32_t tx_len, +static inline int bt_spi_transceive(void *tx, u32_t tx_len, void *rx, u32_t rx_len) { - /* - * It's OK to cast away const here: &spi_tx_buf is treated as - * const by spi_transceive(). - */ - spi_tx_buf.buf = (void *)tx; + spi_tx_buf.buf = tx; spi_tx_buf.len = (size_t)tx_len; spi_rx_buf.buf = rx; spi_rx_buf.len = (size_t)rx_len; - return spi_transceive(&spi_conf, &spi_tx_buf, 1, &spi_rx_buf, 1); + return spi_transceive(spi_dev, &spi_conf, &spi_tx, &spi_rx); } #endif /* CONFIG_SPI_LEGACY_API */