[PATCH] net: dma: use dmaengine_desc_set_callback()

Frank Li Frank.li at oss.nxp.com
Tue Nov 3 07:06:03 PST 2026


On Mon, Nov 02, 2026 at 03:28:33PM -0800, Joe Damato wrote:
> On Mon, Nov 02, 2026 at 02:19:16PM -0500, Frank.Li at oss.nxp.com wrote:
> > From: Frank Li <Frank.Li at nxp.com>
> >
> > Replace open-coded assignments to callback and callback_param fields
> > of struct dma_async_tx_descriptor with calls to the
> > dmaengine_desc_set_callback() helper across net drivers.
> >
> > No functional change intended. Prepare to make struct
> > dma_async_tx_descriptor private to the DMA engine.
> >
> > Signed-off-by: Frank Li <Frank.Li at nxp.com>
> > ---
> >  drivers/net/ethernet/allwinner/sun4i-emac.c       |  3 +--
> >  drivers/net/ethernet/micrel/ks8842.c              |  6 ++----
> >  drivers/net/ethernet/xilinx/xilinx_axienet_main.c |  6 ++----
> >  drivers/net/wwan/qcom_bam_dmux.c                  | 10 ++++------
> >  4 files changed, 9 insertions(+), 16 deletions(-)
>
> [...]
>
> > diff --git a/drivers/net/wwan/qcom_bam_dmux.c b/drivers/net/wwan/qcom_bam_dmux.c
> > index cc6ace8d64371..1479f8362e04e 100644
> > --- a/drivers/net/wwan/qcom_bam_dmux.c
> > +++ b/drivers/net/wwan/qcom_bam_dmux.c
> > @@ -195,9 +195,8 @@ static bool bam_dmux_skb_dma_submit_tx(struct bam_dmux_skb_dma *skb_dma)
> >  		return false;
> >  	}
> >
> > -	desc->callback = bam_dmux_tx_callback;
> > -	desc->callback_param = skb_dma;
> > -	desc->cookie = dmaengine_submit(desc);
> > +	dmaengine_desc_set_callback(desc, bam_dmux_tx_callback, NULL, skb_dma);
> > +	dmaengine_submit(desc);
> >  	return true;
> >  }
> >
> > @@ -477,9 +476,8 @@ static bool bam_dmux_skb_dma_submit_rx(struct bam_dmux_skb_dma *skb_dma)
> >  		return false;
> >  	}
> >
> > -	desc->callback = bam_dmux_rx_callback;
> > -	desc->callback_param = skb_dma;
> > -	desc->cookie = dmaengine_submit(desc);
> > +	dmaengine_desc_set_callback(desc, bam_dmux_rx_callback, NULL, skb_dma);
> > +	dmaengine_submit(desc);
>
> I noticed in the above that the return value of dmaengine_submit is discarded
> instead of stored.
>
> Is that intentional? I suppose it might be because AFAICT cookie is never
> used and the commit message says "no functional change intended".

dma_cookie_assign() already set desc->cookie in dmaengine_submit(). Of couse
it is not obvious. Do you need me update commit message to descript it.

Frank

>
> Reviewed-by: Joe Damato <joe at dama.to>



More information about the linux-arm-kernel mailing list