Re: [PATCH v3 3/4] dmaengine: add (dmaengine|vchan)_chan_dev() helper

From: Vinod Koul

Date: Wed Sep 09 2026 - 08:53:41 EST


On 07-09-26, 10:55, Amelie Delaunay wrote:
> Hi Frank,
>
> On 9/4/26 23:49, Frank.Li@xxxxxxxxxxx wrote:
> [...]
>
> I don't think removing chan2dev() function from the STM32 DMA drivers is an
> improvement, since the parameter is a `stm32` chan, not a `dma_chan`.
> chan2dev() was meant to expose the channel device behind the `stm32` wrapper
> and keep logging concise.
>
> > diff --git a/drivers/dma/stm32/stm32-dma.c b/drivers/dma/stm32/stm32-dma.c
> > index 3e8151e2ad75a..4688cebaf7f7a 100644
> > --- a/drivers/dma/stm32/stm32-dma.c
> > +++ b/drivers/dma/stm32/stm32-dma.c
> > @@ -248,11 +248,6 @@ static struct stm32_dma_desc *to_stm32_dma_desc(struct virt_dma_desc *vdesc)
> > return container_of(vdesc, struct stm32_dma_desc, vdesc);
> > }
> > -static struct device *chan2dev(struct stm32_dma_chan *chan)
> > -{
> > - return &chan->vchan.chan.dev->device;
> > -}
> > -
>
> I would rather keep it as:
>
> static struct device *chan2dev(struct stm32_dma_chan *chan)
> {
> return vchan_chan_dev(&chan->vchan);
> }
>
> and then drop all further updates.

I would say better to use a common macro than keep one for yours

--
~Vinod