Re: [PATCH] dma-coherent: add support for multi coherent rmems per dev

From: Andy Shevchenko
Date: Fri Feb 02 2024 - 10:22:13 EST


On Fri, Feb 02, 2024 at 12:40:59PM +0800, Howard Yen wrote:
> On Thu, Feb 1, 2024 at 11:41 PM Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> > On Thu, Feb 01, 2024 at 10:45:30AM +0000, Robin Murphy wrote:
> > > On 2024-02-01 9:35 am, Howard Yen wrote:

..

> I'm considering to modify the change to
>
> 1. Move it into the dma_coherent_mem structure, like
>
> HEAD
> mem0->node
>
> This case, if I check list_empty(mem0->node), it would give me the
> list is empty, but actually there is one rmem.
>
> 2. Replace the pointer to a list_head.
>
> HEAD
> dma_mems ---> mem0->node
>
> This case, if I check list_empty(dma_mems), it would give me the list
> is non-empty, it matches the actual status.
>
> So, the 2nd looks reasonable, I'm going to upload a v2 patch with the
> 2nd approach, does that make sense?

I believe this is exactly what Robin told about "list to replace the pointer".

--
With Best Regards,
Andy Shevchenko