Skip to content

Commit d22607a

Browse files
decsnykartben
authored andcommitted
drivers: i2s_mcux_sai: make word_size_bytes var
Creating this local variable saves some text space in ROM Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
1 parent 9e0e41e commit d22607a

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

drivers/i2s/i2s_mcux_sai.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir,
441441
enum i2s_state *tx_state = &(dev_data->tx.state);
442442
enum i2s_state *rx_state = &(dev_data->rx.state);
443443
uint8_t word_size_bits = i2s_cfg->word_size;
444+
uint8_t word_size_bytes = word_size_bits / 8;
444445
uint8_t num_words = i2s_cfg->channels;
445446
sai_transceiver_t config;
446447
int ret = -EINVAL;
@@ -608,10 +609,10 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir,
608609
i2s_cfg->channels);
609610
LOG_DBG("tx start_channel = %d", dev_data->tx.start_channel);
610611
/*set up dma settings*/
611-
dev_data->tx.dma_cfg.source_data_size = word_size_bits / 8;
612-
dev_data->tx.dma_cfg.dest_data_size = word_size_bits / 8;
613-
dev_data->tx.dma_cfg.source_burst_length = i2s_cfg->word_size / 8;
614-
dev_data->tx.dma_cfg.dest_burst_length = i2s_cfg->word_size / 8;
612+
dev_data->tx.dma_cfg.source_data_size = word_size_bytes;
613+
dev_data->tx.dma_cfg.dest_data_size = word_size_bytes;
614+
dev_data->tx.dma_cfg.source_burst_length = word_size_bytes;
615+
dev_data->tx.dma_cfg.dest_burst_length = word_size_bytes;
615616
dev_data->tx.dma_cfg.user_data = (void *)dev;
616617
dev_data->tx.state = I2S_STATE_READY;
617618
} else {
@@ -631,10 +632,10 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir,
631632
i2s_cfg->channels);
632633
LOG_DBG("rx start_channel = %d", dev_data->rx.start_channel);
633634
/*set up dma settings*/
634-
dev_data->rx.dma_cfg.source_data_size = word_size_bits / 8;
635-
dev_data->rx.dma_cfg.dest_data_size = word_size_bits / 8;
636-
dev_data->rx.dma_cfg.source_burst_length = i2s_cfg->word_size / 8;
637-
dev_data->rx.dma_cfg.dest_burst_length = i2s_cfg->word_size / 8;
635+
dev_data->rx.dma_cfg.source_data_size = word_size_bytes;
636+
dev_data->rx.dma_cfg.dest_data_size = word_size_bytes;
637+
dev_data->rx.dma_cfg.source_burst_length = word_size_bytes;
638+
dev_data->rx.dma_cfg.dest_burst_length = word_size_bytes;
638639
dev_data->rx.dma_cfg.user_data = (void *)dev;
639640
dev_data->rx.state = I2S_STATE_READY;
640641
}

0 commit comments

Comments
 (0)