dmaengine: mv_xor_v2: fixes and alignment for XOR-v2 driver
cover dmaengine: mv_xor_v2: fixes and alignment for XOR-v2 driver
From: Hanna Hawa <[email protected]>
This series bring some minor fixes & alignmnet to the driver of Marvell XOR-v2 engine.
Thanks,
Hanna
Hanna Hawa (5):
dmaengine: mv_xor_v2: explicitly freeup irq
dmaengine: mv_xor_v2: kill the tasklets upon exit
dmaengine: mv_xor_v2: convert callback to helper function
dmaengine: mv_xor_v2: move unmap to before callback
dmaengine: mv_xor_v2: enable COMPILE_TEST
drivers/dma/Kconfig | 2 +- drivers/dma/mv_xor_v2.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/5 dmaengine: mv_xor_v2: explicitly freeup irq
From: Hanna Hawa <[email protected]>
dmaengine device should explicitly call devm_free_irq() when using devm_request_irq().
The irq is still ON when devices remove is executed and irq should be quiesced before remove is completed.
--- drivers/dma/mv_xor_v2.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/dma/mv_xor_v2.c +4 -0
@@ -174,6 +174,7 @@ struct mv_xor_v2_device {int desc_size;unsigned int npendings;unsigned int hw_queue_idx; +struct msi_desc *msi_desc; };/**
@@ -780,6 +781,7 @@ static int mv_xor_v2_probe(struct platform_device *pdev) msi_desc =first_msi_entry (&pdev->dev);if (!msi_desc) goto free_msi_irqs; + xor_dev->msi_desc = msi_desc; ret = devm_request_irq(&pdev->dev, msi_desc->irq, mv_xor_v2_interrupt_handler, 0,
@@ -897,6 +899,8 @@ static int mv_xor_v2_remove(struct platform_device *pdev) xor_dev->desc_size *MV_XOR_V2_DESC_NUM , xor_dev->hw_desq_virt, xor_dev->hw_desq); +devm_free_irq (&pdev->dev, xor_dev->msi_desc->irq, xor_dev); +platform_msi_domain_free_irqs (&pdev->dev);clk_disable_unprepare (xor_dev->clk);
PATCH 2/5 dmaengine: mv_xor_v2: kill the tasklets upon exit
In reply to [email protected]From: Hanna Hawa <[email protected]>
The mv_xor_v2 driver uses a tasklet, initialized during the probe() routine. However, it forgets to cleanup the tasklet using tasklet_kill() function during the remove() routine, which this patch fixes. This prevents the tasklet from potentially running after the module has been removed.
--- drivers/dma/mv_xor_v2.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/dma/mv_xor_v2.c +2 -0
@@ -903,6 +903,8 @@ static int mv_xor_v2_remove(struct platform_device *pdev)platform_msi_domain_free_irqs (&pdev->dev); +tasklet_kill (&xor_dev->irq_tasklet); +clk_disable_unprepare (xor_dev->clk);return 0 ;
PATCH 3/5 dmaengine: mv_xor_v2: convert callback to helper function
In reply to [email protected]From: Hanna Hawa <[email protected]>
This is in preperation of moving to a callback that provides results to the callback for the transaction. The conversion will maintain current behavior and the driver must convert to new callback mechanism at a later time in order to receive results.
--- drivers/dma/mv_xor_v2.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/dma/mv_xor_v2.c +2 -3
@@ -589,9 +589,8 @@ static void mv_xor_v2_tasklet(unsigned long data)*/ dma_cookie_complete (&next_pending_sw_desc->async_tx); -if (next_pending_sw_desc->async_tx.callback) - next_pending_sw_desc->async_tx.callback ( - next_pending_sw_desc->async_tx.callback_param); +dmaengine_desc_get_callback_invoke ( + &next_pending_sw_desc->async_tx,NULL );dma_descriptor_unmap (&next_pending_sw_desc->async_tx); }
Vinod
maintainerRe: [PATCH 3/5] dmaengine: mv_xor_v2: convert callback to helper function
Quoted 3 lines · On 17-07-18, 13:30, [email protected] wrote:
From: Hanna Hawa <[email protected]>
This is in preperation of moving to a callback that provides results to the
typo preperation
Quoted 25 lines
callback for the transaction. The conversion will maintain current behavior and the driver must convert to new callback mechanism at a later time in order to receive results.
Signed-off-by Hanna Hawa <[email protected]>--- drivers/dma/mv_xor_v2.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/dma/mv_xor_v2.c +2
-3@@ -589,9 +589,8 @@ static void mv_xor_v2_tasklet(unsigned long data)*/ dma_cookie_complete (&next_pending_sw_desc->async_tx); -if (next_pending_sw_desc->async_tx.callback) - next_pending_sw_desc->async_tx.callback ( - next_pending_sw_desc->async_tx.callback_param); +dmaengine_desc_get_callback_invoke ( + &next_pending_sw_desc->async_tx,NULL );dma_descriptor_unmap (&next_pending_sw_desc->async_tx); }
PATCH 4/5 dmaengine: mv_xor_v2: move unmap to before callback
In reply to [email protected]From: Hanna Hawa <[email protected]>
Completion callback should happen after dma_descriptor_unmap() has happened. This allow the cache invalidate to happen and ensure that the data accessed by the upper layer is in memory that was from DMA rather than stale data. On some architecture this is done by the hardware, however we should make the code consistent to not cause confusion.
--- drivers/dma/mv_xor_v2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/dma/mv_xor_v2.c +1 -2
@@ -589,10 +589,9 @@ static void mv_xor_v2_tasklet(unsigned long data)*/ dma_cookie_complete (&next_pending_sw_desc->async_tx); +dma_descriptor_unmap (&next_pending_sw_desc->async_tx);dmaengine_desc_get_callback_invoke ( &next_pending_sw_desc->async_tx,NULL ); - -dma_descriptor_unmap (&next_pending_sw_desc->async_tx); }dma_run_dependencies (&next_pending_sw_desc->async_tx);
PATCH 5/5 dmaengine: mv_xor_v2: enable COMPILE_TEST
In reply to [email protected]From: Hanna Hawa <[email protected]>
To get more coverage, enable COMPILE_TEST for this driver.
--- drivers/dma/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/Kconfig +1 -1
@@ -366,7 +366,7 @@ config MV_XOR config MV_XOR_V2 bool "Marvell XOR engine version 2 support " - depends on ARM64 + depends on ARM64 || COMPILE_TEST select DMA_ENGINE select DMA_ENGINE_RAID select ASYNC_TX_ENABLE_CHANNEL_SWITCH
Vinod
maintainerQuoted 4 lines · On 17-07-18, 13:29, [email protected] wrote:
From: Hanna Hawa <[email protected]>
This series bring some minor fixes & alignmnet to the driver of Marvell XOR-v2 engine.
Applied after fixing typo is 3rd patch, thanks
Signature · 1 line
~Vinod