diff mbox

[02/40] dmaengine: at_hdmac: convert callback to helper function

Message ID 146853341763.12248.12246775024037350361.stgit@djiang5-desk3.ch.intel.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Dave Jiang July 14, 2016, 9:56 p.m. UTC
Convert driver to use the new helper function for callback

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/dma/at_hdmac.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Ludovic Desroches July 15, 2016, 1:37 p.m. UTC | #1
On Thu, Jul 14, 2016 at 02:56:57PM -0700, Dave Jiang wrote:
> Convert driver to use the new helper function for callback
> 
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>

Tested-by: Ludovic Desroches <ludovic.desroches@atmel.com>

> ---
>  drivers/dma/at_hdmac.c |   14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index 53d22eb..e1622d0 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -473,15 +473,14 @@ atc_chain_complete(struct at_dma_chan *atchan, struct at_desc *desc)
>  	/* for cyclic transfers,
>  	 * no need to replay callback function while stopping */
>  	if (!atc_chan_is_cyclic(atchan)) {
> -		dma_async_tx_callback	callback = txd->callback;
> -		void			*param = txd->callback_param;
> +		struct dma_desc_callback	cb;
>  
>  		/*
>  		 * The API requires that no submissions are done from a
>  		 * callback, so we don't need to drop the lock here
>  		 */
> -		if (callback)
> -			callback(param);
> +		dmaengine_desc_get_callback(txd, &cb);
> +		dmaengine_desc_callback_invoke(&cb, NULL);
>  	}
>  
>  	dma_run_dependencies(txd);
> @@ -598,15 +597,14 @@ static void atc_handle_cyclic(struct at_dma_chan *atchan)
>  {
>  	struct at_desc			*first = atc_first_active(atchan);
>  	struct dma_async_tx_descriptor	*txd = &first->txd;
> -	dma_async_tx_callback		callback = txd->callback;
> -	void				*param = txd->callback_param;
> +	struct dma_desc_callback	cb;
>  
>  	dev_vdbg(chan2dev(&atchan->chan_common),
>  			"new cyclic period llp 0x%08x\n",
>  			channel_readl(atchan, DSCR));
>  
> -	if (callback)
> -		callback(param);
> +	dmaengine_desc_get_callback(txd, &cb);
> +	dmaengine_desc_callback_invoke(&cb, NULL);
>  }
>  
>  /*--  IRQ & Tasklet  ---------------------------------------------------*/
> 
> --
> To unsubscribe from this list: send the line "unsubscribe dmaengine" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lars-Peter Clausen July 17, 2016, 6:41 p.m. UTC | #2
On 07/14/2016 11:56 PM, Dave Jiang wrote:
> Convert driver to use the new helper function for callback

In addition to what is done the commit messages should really explain why
and how it is done.

--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 53d22eb..e1622d0 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -473,15 +473,14 @@  atc_chain_complete(struct at_dma_chan *atchan, struct at_desc *desc)
 	/* for cyclic transfers,
 	 * no need to replay callback function while stopping */
 	if (!atc_chan_is_cyclic(atchan)) {
-		dma_async_tx_callback	callback = txd->callback;
-		void			*param = txd->callback_param;
+		struct dma_desc_callback	cb;
 
 		/*
 		 * The API requires that no submissions are done from a
 		 * callback, so we don't need to drop the lock here
 		 */
-		if (callback)
-			callback(param);
+		dmaengine_desc_get_callback(txd, &cb);
+		dmaengine_desc_callback_invoke(&cb, NULL);
 	}
 
 	dma_run_dependencies(txd);
@@ -598,15 +597,14 @@  static void atc_handle_cyclic(struct at_dma_chan *atchan)
 {
 	struct at_desc			*first = atc_first_active(atchan);
 	struct dma_async_tx_descriptor	*txd = &first->txd;
-	dma_async_tx_callback		callback = txd->callback;
-	void				*param = txd->callback_param;
+	struct dma_desc_callback	cb;
 
 	dev_vdbg(chan2dev(&atchan->chan_common),
 			"new cyclic period llp 0x%08x\n",
 			channel_readl(atchan, DSCR));
 
-	if (callback)
-		callback(param);
+	dmaengine_desc_get_callback(txd, &cb);
+	dmaengine_desc_callback_invoke(&cb, NULL);
 }
 
 /*--  IRQ & Tasklet  ---------------------------------------------------*/