From 63ae0625af9207da6c75c8e5fbba616c1b035771 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Wed, 20 Nov 2024 18:03:16 -0600 Subject: [PATCH] drivers: i2s_mcux_sai: make word_size_bytes var Creating this local variable saves some text space in ROM Signed-off-by: Declan Snyder --- drivers/i2s/i2s_mcux_sai.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/i2s/i2s_mcux_sai.c b/drivers/i2s/i2s_mcux_sai.c index 918974198539a04..69e9eeefca09c35 100644 --- a/drivers/i2s/i2s_mcux_sai.c +++ b/drivers/i2s/i2s_mcux_sai.c @@ -440,6 +440,7 @@ static int i2s_nxp_sai_config(const struct device *dev, enum i2s_dir dir, enum i2s_state *tx_state = &(dev_data->tx.state); enum i2s_state *rx_state = &(dev_data->rx.state); uint8_t word_size_bits = i2s_cfg->word_size; + uint8_t word_size_bytes = word_size_bits / 8; uint8_t num_words = i2s_cfg->channels; sai_transceiver_t config; int ret = -EINVAL; @@ -607,10 +608,10 @@ static int i2s_nxp_sai_config(const struct device *dev, enum i2s_dir dir, i2s_cfg->channels); LOG_DBG("tx start_channel = %d", dev_data->tx.start_channel); /*set up dma settings*/ - dev_data->tx.dma_cfg.source_data_size = word_size_bits / 8; - dev_data->tx.dma_cfg.dest_data_size = word_size_bits / 8; - dev_data->tx.dma_cfg.source_burst_length = i2s_cfg->word_size / 8; - dev_data->tx.dma_cfg.dest_burst_length = i2s_cfg->word_size / 8; + dev_data->tx.dma_cfg.source_data_size = word_size_bytes; + dev_data->tx.dma_cfg.dest_data_size = word_size_bytes; + dev_data->tx.dma_cfg.source_burst_length = word_size_bytes; + dev_data->tx.dma_cfg.dest_burst_length = word_size_bytes; dev_data->tx.dma_cfg.user_data = (void *)dev; dev_data->tx.state = I2S_STATE_READY; } else { @@ -630,10 +631,10 @@ static int i2s_nxp_sai_config(const struct device *dev, enum i2s_dir dir, i2s_cfg->channels); LOG_DBG("rx start_channel = %d", dev_data->rx.start_channel); /*set up dma settings*/ - dev_data->rx.dma_cfg.source_data_size = word_size_bits / 8; - dev_data->rx.dma_cfg.dest_data_size = word_size_bits / 8; - dev_data->rx.dma_cfg.source_burst_length = i2s_cfg->word_size / 8; - dev_data->rx.dma_cfg.dest_burst_length = i2s_cfg->word_size / 8; + dev_data->rx.dma_cfg.source_data_size = word_size_bytes; + dev_data->rx.dma_cfg.dest_data_size = word_size_bytes; + dev_data->rx.dma_cfg.source_burst_length = word_size_bytes; + dev_data->rx.dma_cfg.dest_burst_length = word_size_bytes; dev_data->rx.dma_cfg.user_data = (void *)dev; dev_data->rx.state = I2S_STATE_READY; }