Message ID | 1441972234-8643-9-git-send-email-sakari.ailus@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Sakari, Thank you for the patch. On Friday 11 Sep 2015 14:50:31 Sakari Ailus wrote: > Just move the function up. It'll be soon needed earlier than previously. > > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> I would move this patch to 09/11 though, just before the patch that requires it. > --- > drivers/media/v4l2-core/videobuf2-dma-contig.c | 44 +++++++++++------------ > 1 file changed, 22 insertions(+), 22 deletions(-) > > diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c > b/drivers/media/v4l2-core/videobuf2-dma-contig.c index 26a0a0f..3260392 > 100644 > --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c > +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c > @@ -82,6 +82,28 @@ static unsigned long vb2_dc_get_contiguous_size(struct > sg_table *sgt) return size; > } > > +static struct sg_table *vb2_dc_get_base_sgt(struct vb2_dc_buf *buf) > +{ > + int ret; > + struct sg_table *sgt; > + > + sgt = kmalloc(sizeof(*sgt), GFP_KERNEL); > + if (!sgt) { > + dev_err(buf->dev, "failed to alloc sg table\n"); > + return NULL; > + } > + > + ret = dma_get_sgtable(buf->dev, sgt, buf->vaddr, buf->dma_addr, > + buf->size); > + if (ret < 0) { > + dev_err(buf->dev, "failed to get scatterlist from DMA API\n"); > + kfree(sgt); > + return NULL; > + } > + > + return sgt; > +} > + > /*********************************************/ > /* callbacks for all buffers */ > /*********************************************/ > @@ -375,28 +397,6 @@ static struct dma_buf_ops vb2_dc_dmabuf_ops = { > .release = vb2_dc_dmabuf_ops_release, > }; > > -static struct sg_table *vb2_dc_get_base_sgt(struct vb2_dc_buf *buf) > -{ > - int ret; > - struct sg_table *sgt; > - > - sgt = kmalloc(sizeof(*sgt), GFP_KERNEL); > - if (!sgt) { > - dev_err(buf->dev, "failed to alloc sg table\n"); > - return NULL; > - } > - > - ret = dma_get_sgtable(buf->dev, sgt, buf->vaddr, buf->dma_addr, > - buf->size); > - if (ret < 0) { > - dev_err(buf->dev, "failed to get scatterlist from DMA API\n"); > - kfree(sgt); > - return NULL; > - } > - > - return sgt; > -} > - > static struct dma_buf *vb2_dc_get_dmabuf(void *buf_priv, unsigned long > flags) { > struct vb2_dc_buf *buf = buf_priv;
diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index 26a0a0f..3260392 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c @@ -82,6 +82,28 @@ static unsigned long vb2_dc_get_contiguous_size(struct sg_table *sgt) return size; } +static struct sg_table *vb2_dc_get_base_sgt(struct vb2_dc_buf *buf) +{ + int ret; + struct sg_table *sgt; + + sgt = kmalloc(sizeof(*sgt), GFP_KERNEL); + if (!sgt) { + dev_err(buf->dev, "failed to alloc sg table\n"); + return NULL; + } + + ret = dma_get_sgtable(buf->dev, sgt, buf->vaddr, buf->dma_addr, + buf->size); + if (ret < 0) { + dev_err(buf->dev, "failed to get scatterlist from DMA API\n"); + kfree(sgt); + return NULL; + } + + return sgt; +} + /*********************************************/ /* callbacks for all buffers */ /*********************************************/ @@ -375,28 +397,6 @@ static struct dma_buf_ops vb2_dc_dmabuf_ops = { .release = vb2_dc_dmabuf_ops_release, }; -static struct sg_table *vb2_dc_get_base_sgt(struct vb2_dc_buf *buf) -{ - int ret; - struct sg_table *sgt; - - sgt = kmalloc(sizeof(*sgt), GFP_KERNEL); - if (!sgt) { - dev_err(buf->dev, "failed to alloc sg table\n"); - return NULL; - } - - ret = dma_get_sgtable(buf->dev, sgt, buf->vaddr, buf->dma_addr, - buf->size); - if (ret < 0) { - dev_err(buf->dev, "failed to get scatterlist from DMA API\n"); - kfree(sgt); - return NULL; - } - - return sgt; -} - static struct dma_buf *vb2_dc_get_dmabuf(void *buf_priv, unsigned long flags) { struct vb2_dc_buf *buf = buf_priv;
Just move the function up. It'll be soon needed earlier than previously. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> --- drivers/media/v4l2-core/videobuf2-dma-contig.c | 44 +++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-)