Skip to contentSkip to conversation

dmaengine: timb_dma: Use proper enum in td_prep_slave_sg

PATCH Applied Nathan Chancellor 3 participants 3 messages Sep 11, 2018 – Oct 2, 2018 dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: timb_dma: Use proper enum in td_prep_slave_sg

Clang warns when implicitly converting from one enumerated type to another. Avoid this by using the equivalent value from the expected type.

drivers/dma/timb_dma.c:548:27: warning: implicit conversion from enumeration type 'enum dma_transfer_direction' to different enumeration type 'enum dma_data_direction' [-Wenum-conversion]

                td_desc->desc_list_len, DMA_MEM_TO_DEV);
                                        ^~~~~~~~~~~~~~

1 warning generated.

---
 drivers/dma/timb_dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/timb_dma.c +1 -1
index 395c698edb4d..fc0f9c8766a8 100644
@@ -545,7 +545,7 @@ static struct dma_async_tx_descriptor *td_prep_slave_sg(struct dma_chan *chan,
 	}
 
 	dma_sync_single_for_device(chan2dmadev(chan), td_desc->txd.phys,
-		td_desc->desc_list_len, DMA_MEM_TO_DEV);
+		td_desc->desc_list_len, DMA_TO_DEVICE);
 
 	return &td_desc->txd;
 }
Reviewed-by on v1 1/1
#1 lore raw
Quoted 23 lines · Nathan Chancellor

Clang warns when implicitly converting from one enumerated type to another. Avoid this by using the equivalent value from the expected type.

drivers/dma/timb_dma.c:548:27: warning: implicit conversion from enumeration type 'enum dma_transfer_direction' to different enumeration type 'enum dma_data_direction' [-Wenum-conversion]

                td_desc->desc_list_len, DMA_MEM_TO_DEV);
                                        ^~~~~~~~~~~~~~

1 warning generated.

---
 drivers/dma/timb_dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/timb_dma.c +0 -0
index 395c698edb4d..fc0f9c8766a8 100644

drivers/dma/timb_dma.c static struct dma_async_tx_descriptor *td_prep_slave_sg(struct dma_chan *chan, · line 548

Quoted 5 lines
drivers/dma/timb_dma.c +1 -1
@@ -545,7 +545,7 @@ static struct dma_async_tx_descriptor *td_prep_slave_sg(struct dma_chan *chan,
        }
 
        dma_sync_single_for_device(chan2dmadev(chan), td_desc->txd.phys,
-               td_desc->desc_list_len, DMA_MEM_TO_DEV);
+               td_desc->desc_list_len, DMA_TO_DEVICE);

Looks like DMA_MEM_TO_DEV and DMA_TO_DEVICE happen to have the same value (today) so no functional change.
And dma_sync_single_for_device is defined to take the enum dma_data_direction which DMA_TO_DEVICE is an enumeration of.

Thanks for the patch Nathan.

Quoted 6 lines
drivers/dma/timb_dma.c +0 -1
        return &td_desc->txd;
 }
--

2.18.0

maintainer Applied
#2 lore raw
In reply to Nathan Chancellor
Quoted 10 lines · Nathan Chancellor

Clang warns when implicitly converting from one enumerated type to another. Avoid this by using the equivalent value from the expected type.

drivers/dma/timb_dma.c:548:27: warning: implicit conversion from enumeration type 'enum dma_transfer_direction' to different enumeration type 'enum dma_data_direction' [-Wenum-conversion]

                td_desc->desc_list_len, DMA_MEM_TO_DEV);
                                        ^~~~~~~~~~~~~~

1 warning generated.

Applied, thanks