Re: [PATCH v3 02/25] drm: core: fix common struct sg_table related issues

2020-05-12 Thread Marek Szyprowski
Hi Christoph, On 08.05.2020 09:16, Christoph Hellwig wrote: > On Fri, May 08, 2020 at 09:12:13AM +0200, Marek Szyprowski wrote: >> Then we would just need one more helper to construct scatterlist, as the >> above two are read-only don't allow to modify scatterlist: >> >> #define

Re: [PATCH v3 02/25] drm: core: fix common struct sg_table related issues

2020-05-08 Thread Christoph Hellwig
On Fri, May 08, 2020 at 09:12:13AM +0200, Marek Szyprowski wrote: > Then we would just need one more helper to construct scatterlist, as the > above two are read-only don't allow to modify scatterlist: > > #define for_each_sgtable_sg(sgt, sg, i)    \ >    for_each_sg(sgt->sgl,

Re: [PATCH v3 02/25] drm: core: fix common struct sg_table related issues

2020-05-08 Thread Marek Szyprowski
Hi Christoph, On 05.05.2020 13:09, Christoph Hellwig wrote: > On Tue, May 05, 2020 at 12:51:58PM +0200, Marek Szyprowski wrote: >> On 05.05.2020 12:15, Christoph Hellwig wrote: - for_each_sg_page(st->sgl, _iter, st->nents, 0) + for_each_sg_page(st->sgl, _iter,

Re: [PATCH v3 02/25] drm: core: fix common struct sg_table related issues

2020-05-05 Thread Christoph Hellwig
On Tue, May 05, 2020 at 12:51:58PM +0200, Marek Szyprowski wrote: > Hi Christoph, > > On 05.05.2020 12:15, Christoph Hellwig wrote: > >> - for_each_sg_page(st->sgl, _iter, st->nents, 0) > >> + for_each_sg_page(st->sgl, _iter, st->orig_nents, 0) > > Would it make sense to also

Re: [PATCH v3 02/25] drm: core: fix common struct sg_table related issues

2020-05-05 Thread Marek Szyprowski
Hi Christoph, On 05.05.2020 12:15, Christoph Hellwig wrote: >> -for_each_sg_page(st->sgl, _iter, st->nents, 0) >> +for_each_sg_page(st->sgl, _iter, st->orig_nents, 0) > Would it make sense to also add a for_each_sgtable_page helper that > hides the use of orig_nents? To

Re: [PATCH v3 02/25] drm: core: fix common struct sg_table related issues

2020-05-05 Thread Christoph Hellwig
> - for_each_sg_page(st->sgl, _iter, st->nents, 0) > + for_each_sg_page(st->sgl, _iter, st->orig_nents, 0) Would it make sense to also add a for_each_sgtable_page helper that hides the use of orig_nents? To be used like: for_each_sgtable_page(st, _iter,

[PATCH v3 02/25] drm: core: fix common struct sg_table related issues

2020-05-05 Thread Marek Szyprowski
The Documentation/DMA-API-HOWTO.txt states that dma_map_sg returns the numer of the created entries in the DMA address space. However the subsequent calls to dma_sync_sg_for_{device,cpu} and dma_unmap_sg must be called with the original number of the entries passed to dma_map_sg. The