Patch "dmaengine: dmaengine_desc_callback_valid(): Check for `callback_result`" has been added to the 4.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    dmaengine: dmaengine_desc_callback_valid(): Check for `callback_result`

to the 4.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     dmaengine-dmaengine_desc_callback_valid-check-for-ca.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 2f5ee188111883924ab695b13beb215627062136
Author: Lars-Peter Clausen <lars@xxxxxxxxxx>
Date:   Sat Oct 23 15:41:01 2021 +0200

    dmaengine: dmaengine_desc_callback_valid(): Check for `callback_result`
    
    [ Upstream commit e7e1e880b114ca640a2f280b0d5d38aed98f98c6 ]
    
    Before the `callback_result` callback was introduced drivers coded their
    invocation to the callback in a similar way to:
    
            if (cb->callback) {
                    spin_unlock(&dma->lock);
                    cb->callback(cb->callback_param);
                    spin_lock(&dma->lock);
            }
    
    With the introduction of `callback_result` two helpers where introduced to
    transparently handle both types of callbacks. And drivers where updated to
    look like this:
    
            if (dmaengine_desc_callback_valid(cb)) {
                    spin_unlock(&dma->lock);
                    dmaengine_desc_callback_invoke(cb, ...);
                    spin_lock(&dma->lock);
            }
    
    dmaengine_desc_callback_invoke() correctly handles both `callback_result`
    and `callback`. But we forgot to update the dmaengine_desc_callback_valid()
    function to check for `callback_result`. As a result DMA descriptors that
    use the `callback_result` rather than `callback` don't have their callback
    invoked by drivers that follow the pattern above.
    
    Fix this by checking for both `callback` and `callback_result` in
    dmaengine_desc_callback_valid().
    
    Fixes: f067025bc676 ("dmaengine: add support to provide error result from a DMA transation")
    Signed-off-by: Lars-Peter Clausen <lars@xxxxxxxxxx>
    Acked-by: Dave Jiang <dave.jiang@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20211023134101.28042-1-lars@xxxxxxxxxx
    Signed-off-by: Vinod Koul <vkoul@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/dma/dmaengine.h b/drivers/dma/dmaengine.h
index 501c0b063f852..302f13efd35d9 100644
--- a/drivers/dma/dmaengine.h
+++ b/drivers/dma/dmaengine.h
@@ -168,7 +168,7 @@ dmaengine_desc_get_callback_invoke(struct dma_async_tx_descriptor *tx,
 static inline bool
 dmaengine_desc_callback_valid(struct dmaengine_desc_callback *cb)
 {
-	return (cb->callback) ? true : false;
+	return cb->callback || cb->callback_result;
 }
 
 #endif



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux