Re: [PATCH v3 02/41] dmaengine: at_hdmac: convert callback to helper function

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

 



On Mon, Jul 18, 2016 at 02:47:56PM -0700, Dave Jiang wrote:
> Convert driver to use the new helper function for callback
> 
> Signed-off-by: Dave Jiang <dave.jiang@xxxxxxxxx>

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

> Cc: Nicolas Ferre <nicolas.ferre@xxxxxxxxx>
> ---
>  drivers/dma/at_hdmac.c  |   13 +++++--------
>  drivers/dma/dmaengine.h |    6 ++++++
>  2 files changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index 53d22eb..11203fb 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -473,15 +473,13 @@ 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 dmaengine_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_invoke(txd, &cb, NULL);
>  	}
>  
>  	dma_run_dependencies(txd);
> @@ -598,15 +596,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 dmaengine_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  ---------------------------------------------------*/
> diff --git a/drivers/dma/dmaengine.h b/drivers/dma/dmaengine.h
> index 6fb5edc..e64d27a 100644
> --- a/drivers/dma/dmaengine.h
> +++ b/drivers/dma/dmaengine.h
> @@ -116,4 +116,10 @@ dmaengine_desc_get_callback_invoke(struct dma_async_tx_descriptor *tx,
>  	dmaengine_desc_callback_invoke(cb, result);
>  }
>  
> +static inline bool
> +dmaengine_desc_callback_valid(struct dmaengine_desc_callback *cb)
> +{
> +	return (cb->callback) ? true : false;
> +}
> +
>  #endif
> 
> --
> To unsubscribe from this list: send the line "unsubscribe dmaengine" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux