From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [PATCH v7 2/5] dma-buf: heaps: Add heap helpers Date: Thu, 25 Jul 2019 05:55:54 -0700 Message-ID: <20190725125554.GF20286@infradead.org> References: <20190724003656.59780-1-john.stultz@linaro.org> <20190724003656.59780-3-john.stultz@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20190724003656.59780-3-john.stultz@linaro.org> Sender: linux-kernel-owner@vger.kernel.org To: John Stultz Cc: lkml , Laura Abbott , Benjamin Gaignard , Sumit Semwal , Liam Mark , Pratik Patel , Brian Starkey , Vincent Donnefort , Sudipto Paul , "Andrew F . Davis" , Christoph Hellwig , Chenbo Feng , Alistair Strachan , Hridya Valsaraju , dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org > +struct dma_buf *heap_helper_export_dmabuf( > + struct heap_helper_buffer *helper_buffer, > + int fd_flags) Indentation seems odd here as it doesn't follow any of the usual schools for multi-level prototypes. But maybe shortening some identifier would help avoiding that problem altogether :) > +static void *dma_heap_map_kernel(struct heap_helper_buffer *buffer) > +{ > + void *vaddr; > + > + vaddr = vmap(buffer->pages, buffer->pagecount, VM_MAP, PAGE_KERNEL); > + if (!vaddr) > + return ERR_PTR(-ENOMEM); > + > + return vaddr; > +} Note that a lot of systems don't have highmem at all or don't support CMA in highmem. So for contigous allocations that aren't highmem we could skip the vmap here altogether and just use the direct mapping.