Skip to content

Commit

Permalink
maxim: Fix SPI struct field access
Browse files Browse the repository at this point in the history
msgs is an array of structs, so its fields should be accessed as
msgs[i].field instead.

Fixes: b46faa6 ("drivers: platform: maxim: Update spi_transfer")
Signed-off-by: Ciprian Regus <[email protected]>
  • Loading branch information
CiprianRegus committed Jan 10, 2024
1 parent 99dfa2c commit bef3df1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions drivers/platform/maxim/max32650/maxim_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ int32_t max_spi_transfer(struct no_os_spi_desc *desc,

if (msgs[i].tx_buff) {
/* Set the transfer size in the TX direction */
spi->ctrl1 = msgs->bytes_number;
spi->ctrl1 = msgs[i].bytes_number;
tx_done = false;
/* Enable the TX FIFO */
spi->dma |= MXC_F_SPI_DMA_TX_FIFO_EN;
Expand All @@ -448,7 +448,7 @@ int32_t max_spi_transfer(struct no_os_spi_desc *desc,
if (msgs[i].rx_buff) {
/* Set the transfer size in the RX direction */
spi->ctrl1 |= no_os_field_prep(MXC_F_SPI_CTRL1_RX_NUM_CHAR,
msgs->bytes_number);
msgs[i].bytes_number);
/* Enable the RX FIFO */
spi->dma |= MXC_F_SPI_DMA_RX_FIFO_EN;
rx_done = false;
Expand Down
4 changes: 2 additions & 2 deletions drivers/platform/maxim/max32655/maxim_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ int32_t max_spi_transfer(struct no_os_spi_desc *desc,

if (msgs[i].tx_buff) {
/* Set the transfer size in the TX direction */
spi->ctrl1 = msgs->bytes_number;
spi->ctrl1 = msgs[i].bytes_number;
tx_done = false;
/* Enable the TX FIFO */
spi->dma |= MXC_F_SPI_DMA_TX_FIFO_EN;
Expand All @@ -359,7 +359,7 @@ int32_t max_spi_transfer(struct no_os_spi_desc *desc,
if (msgs[i].rx_buff) {
/* Set the transfer size in the RX direction */
spi->ctrl1 |= no_os_field_prep(MXC_F_SPI_CTRL1_RX_NUM_CHAR,
msgs->bytes_number);
msgs[i].bytes_number);
/* Enable the RX FIFO */
spi->dma |= MXC_F_SPI_DMA_RX_FIFO_EN;
rx_done = false;
Expand Down
4 changes: 2 additions & 2 deletions drivers/platform/maxim/max32660/maxim_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ int32_t max_spi_transfer(struct no_os_spi_desc *desc,

if (msgs[i].tx_buff) {
/* Set the transfer size in the TX direction */
spi->ctrl1 = msgs->bytes_number;
spi->ctrl1 = msgs[i].bytes_number;
tx_done = false;
/* Enable the TX FIFO */
spi->dma |= MXC_F_SPI_DMA_TX_FIFO_EN;
Expand All @@ -352,7 +352,7 @@ int32_t max_spi_transfer(struct no_os_spi_desc *desc,
if (msgs[i].rx_buff) {
/* Set the transfer size in the RX direction */
spi->ctrl1 |= no_os_field_prep(MXC_F_SPI_CTRL1_RX_NUM_CHAR,
msgs->bytes_number);
msgs[i].bytes_number);
/* Enable the RX FIFO */
spi->dma |= MXC_F_SPI_DMA_RX_FIFO_EN;
rx_done = false;
Expand Down
4 changes: 2 additions & 2 deletions drivers/platform/maxim/max32665/maxim_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ int32_t max_spi_transfer(struct no_os_spi_desc *desc,

if (msgs[i].tx_buff) {
/* Set the transfer size in the TX direction */
spi->ctrl1 = msgs->bytes_number;
spi->ctrl1 = msgs[i].bytes_number;
tx_done = false;
/* Enable the TX FIFO */
spi->dma |= MXC_F_SPI_DMA_TX_FIFO_EN;
Expand All @@ -439,7 +439,7 @@ int32_t max_spi_transfer(struct no_os_spi_desc *desc,
if (msgs[i].rx_buff) {
/* Set the transfer size in the RX direction */
spi->ctrl1 |= no_os_field_prep(MXC_F_SPI_CTRL1_RX_NUM_CHAR,
msgs->bytes_number);
msgs[i].bytes_number);
/* Enable the RX FIFO */
spi->dma |= MXC_F_SPI_DMA_RX_FIFO_EN;
rx_done = false;
Expand Down
4 changes: 2 additions & 2 deletions drivers/platform/maxim/max32690/maxim_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ int32_t max_spi_transfer(struct no_os_spi_desc *desc,

if (msgs[i].tx_buff) {
/* Set the transfer size in the TX direction */
spi->ctrl1 = msgs->bytes_number;
spi->ctrl1 = msgs[i].bytes_number;
tx_done = false;
/* Enable the TX FIFO */
spi->dma |= MXC_F_SPI_DMA_TX_FIFO_EN;
Expand All @@ -442,7 +442,7 @@ int32_t max_spi_transfer(struct no_os_spi_desc *desc,
if (msgs[i].rx_buff) {
/* Set the transfer size in the RX direction */
spi->ctrl1 |= no_os_field_prep(MXC_F_SPI_CTRL1_RX_NUM_CHAR,
msgs->bytes_number);
msgs[i].bytes_number);
/* Enable the RX FIFO */
spi->dma |= MXC_F_SPI_DMA_RX_FIFO_EN;
rx_done = false;
Expand Down
4 changes: 2 additions & 2 deletions drivers/platform/maxim/max78000/maxim_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ int32_t max_spi_transfer(struct no_os_spi_desc *desc,

if (msgs[i].tx_buff) {
/* Set the transfer size in the TX direction */
spi->ctrl1 = msgs->bytes_number;
spi->ctrl1 = msgs[i].bytes_number;
tx_done = false;
/* Enable the TX FIFO */
spi->dma |= MXC_F_SPI_DMA_TX_FIFO_EN;
Expand All @@ -356,7 +356,7 @@ int32_t max_spi_transfer(struct no_os_spi_desc *desc,
if (msgs[i].rx_buff) {
/* Set the transfer size in the RX direction */
spi->ctrl1 |= no_os_field_prep(MXC_F_SPI_CTRL1_RX_NUM_CHAR,
msgs->bytes_number);
msgs[i].bytes_number);
/* Enable the RX FIFO */
spi->dma |= MXC_F_SPI_DMA_RX_FIFO_EN;
rx_done = false;
Expand Down

0 comments on commit bef3df1

Please sign in to comment.