Since SDXC_DES_BUFFER_MAX_LEN is always a power of 2,
"(SDXC_DES_BUFFER_MAX_LEN - 1) & SDXC_DES_BUFFER_MAX_LEN" is just a really
complicated way of writing 0.

Since writing 0 to data_buf1_sz means transfer SDXC_DES_BUFFER_MAX_LEN bytes,
there is no need to set remain to SDXC_DES_BUFFER_MAX_LEN when it is 0.

Signed-off-by: Hans de Goede <[email protected]>
---
 drivers/mmc/sunxi_mmc.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index 3adb151..4573621 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -359,8 +359,6 @@ static int mmc_trans_data_by_dma(struct mmc *mmc, struct 
mmc_data *data)
        buff = data->flags & MMC_DATA_READ ?
            (unsigned char *)data->dest : (unsigned char *)data->src;
        remain = byte_cnt & (SDXC_DES_BUFFER_MAX_LEN - 1);
-       if (!remain)
-               remain = SDXC_DES_BUFFER_MAX_LEN;
 
        flush_cache((unsigned long)buff, (unsigned long)byte_cnt);
        for (i = 0; i < buff_frag_num; i++, des_idx++) {
@@ -369,9 +367,7 @@ static int mmc_trans_data_by_dma(struct mmc *mmc, struct 
mmc_data *data)
                pdes[des_idx].own = 1;
                pdes[des_idx].dic = 1;
                if (buff_frag_num > 1 && i != buff_frag_num - 1)
-                       pdes[des_idx].data_buf1_sz =
-                           (SDXC_DES_BUFFER_MAX_LEN -
-                            1) & SDXC_DES_BUFFER_MAX_LEN;
+                       pdes[des_idx].data_buf1_sz = 0; /* 0 == max_len */
                else
                        pdes[des_idx].data_buf1_sz = remain;
 
-- 
1.9.0

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to