From patchwork Wed Oct 10 14:46:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Stanislawski X-Patchwork-Id: 1574591 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 54499DFB34 for ; Wed, 10 Oct 2012 15:21:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1CC4DA0995 for ; Wed, 10 Oct 2012 08:21:04 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by gabe.freedesktop.org (Postfix) with ESMTP id D57B99F577 for ; Wed, 10 Oct 2012 08:02:36 -0700 (PDT) Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MBO00E3CN4CRZB0@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 11 Oct 2012 00:02:36 +0900 (KST) X-AuditID: cbfee61b-b7f2b6d000000f14-fb-50758e0b3ee5 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id EA.DC.03860.B0E85705; Thu, 11 Oct 2012 00:02:36 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MBO002YDME0EC70@mmp1.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 11 Oct 2012 00:02:35 +0900 (KST) From: Tomasz Stanislawski To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCHv10 23/26] v4l: vb2-dma-contig: align buffer size to PAGE_SIZE Date: Wed, 10 Oct 2012 16:46:42 +0200 Message-id: <1349880405-26049-24-git-send-email-t.stanislaws@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1349880405-26049-1-git-send-email-t.stanislaws@samsung.com> References: <1349880405-26049-1-git-send-email-t.stanislaws@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMJMWRmVeSWpSXmKPExsVy+t9jAV2evtIAg0erWSyufH3P5sDocb/7 OFMAYxSXTUpqTmZZapG+XQJXxt+mWewFS9kr2s8uZG1gnMXWxcjJISFgIjH55X9mCFtM4sK9 9UBxLg4hgUWMEu9n32UHSQgJrGOSuLQyFsRmA2o4tuQzI4gtIuAgcfruLGaQBmaBNcwSL1be AJsqLOAr0fNkPVgRi4CqxJ3mtWCDeAU8JR68mcoIsU1e4un9PrB6TqD4hXnTmSGWeUj8X7+Z aQIj7wJGhlWMoqkFyQXFSem5RnrFibnFpXnpesn5uZsYwV5/Jr2DcVWDxSFGAQ5GJR7eioyS ACHWxLLiytxDjBIczEoivKY+pQFCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeZs9UgKEBNITS1Kz U1MLUotgskwcnFINjAvFzu/vrTwsd3lrv47W9rlnPlhoyPRJ3ODYYx/qsCCqbKOHoXFr1frj 2qeFG8/+2v6/qspw74oqtUXH1Z0vrV1r3cF0Ttzd+OxLruB7/Q4TJglNWjOxokn9VE84r8+3 zoC0exMXPVmi97M9tWb/H3WxDR3LTe4WsTlzX1E5p/Llt80ai5obBUosxRmJhlrMRcWJAEv1 NXb2AQAA Cc: t.stanislaws@samsung.com, s.nawrocki@samsung.com, pawel@osciak.com, mchehab@redhat.com, daniel.vetter@ffwll.ch, subashrp@gmail.com, linaro-mm-sig@lists.linaro.org, kyungmin.park@samsung.com, laurent.pinchart@ideasonboard.com, zhangfei.gao@gmail.com, airlied@redhat.com, remi@remlab.net, m.szyprowski@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Most operations on DMA and DMABUF framework need page aligned buffers. This fix guarantees this requirement for vb2-dma-contig buffers. Signed-off-by: Tomasz Stanislawski --- drivers/media/v4l2-core/videobuf2-dma-contig.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index 571a919..002ee50 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c @@ -162,6 +162,9 @@ static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size) if (!buf) return ERR_PTR(-ENOMEM); + /* align image size to PAGE_SIZE */ + size = PAGE_ALIGN(size); + buf->vaddr = dma_alloc_coherent(dev, size, &buf->dma_addr, GFP_KERNEL); if (!buf->vaddr) { dev_err(dev, "dma_alloc_coherent of size %ld failed\n", size);