From patchwork Fri Apr 20 14:45:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Stanislawski X-Patchwork-Id: 7983 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id B58C323E00 for ; Fri, 20 Apr 2012 14:45:48 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 6DEB2A18601 for ; Fri, 20 Apr 2012 14:45:48 +0000 (UTC) Received: by yhpp61 with SMTP id p61so6459554yhp.11 for ; Fri, 20 Apr 2012 07:45:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :mime-version:date:from:in-reply-to:to:message-id:x-mailer :references:cc:subject:x-beenthere:x-mailman-version:precedence :list-id:list-unsubscribe:list-archive:list-post:list-help :list-subscribe:content-type:content-transfer-encoding:sender :errors-to:x-gm-message-state; bh=ItB1XHvpH0DVTSz3DDL4xt+kZkoL5va2F034B/27wD8=; b=e7CFBUNeQVRf+HvRyYC+tNUcOxykQ+YYrTX5u6A0OawTQX29Rw+SWKGmB+qWXnscNs jsImcXLV4kjsHLuevVDvru8YCuo4IxfxZb0CGbiR66QG78qWEw0gq3daDReJGvsDaij8 HRW3ozbKFlG+7LsxF7FHS40yDQW5ZS5Bco9BvnvArtD1FthoXEE3Zzm0nMuRYu7uCqi2 6GMvQpIhN3U8RYwSBnD0/GFuzEFDKKIBGofQyGtiVOQTwUy+80/pjgJxRPHrXPPvQdME PmmSy1DLiMWiJtgLIUp1CVohDiCIj8fqB5RsYe898U9Bz8rvzd0JogNAAarUzkOWXpFx b3eg== Received: by 10.50.185.233 with SMTP id ff9mr21445982igc.55.1334933147695; Fri, 20 Apr 2012 07:45:47 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.137.198 with SMTP id x6csp39007ibt; Fri, 20 Apr 2012 07:45:46 -0700 (PDT) Received: by 10.213.10.69 with SMTP id o5mr561549ebo.91.1334933145482; Fri, 20 Apr 2012 07:45:45 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id s43si6369663weq.78.2012.04.20.07.45.43; Fri, 20 Apr 2012 07:45:45 -0700 (PDT) Received-SPF: neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) client-ip=91.189.95.16; Authentication-Results: mx.google.com; spf=neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) smtp.mail=linaro-mm-sig-bounces@lists.linaro.org Received: from localhost ([127.0.0.1] helo=mombin.canonical.com) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SLF5i-00086U-Ba; Fri, 20 Apr 2012 14:45:42 +0000 Received: from mailout3.w1.samsung.com ([210.118.77.13]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SLF5g-00085d-Eh for linaro-mm-sig@lists.linaro.org; Fri, 20 Apr 2012 14:45:40 +0000 MIME-version: 1.0 Received: from euspt2 ([210.118.77.13]) by mailout3.w1.samsung.com (Sun Java(tm) System Messaging Server 6.3-8.04 (built Jul 29 2009; 32bit)) with ESMTP id <0M2S00NBK8ZC2Z20@mailout3.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Fri, 20 Apr 2012 15:45:12 +0100 (BST) Received: from linux.samsung.com ([106.116.38.10]) by spt2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0M2S00IX9900Q3@spt2.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Fri, 20 Apr 2012 15:45:36 +0100 (BST) Received: from mcdsrvbld02.digital.local (unknown [106.116.37.23]) by linux.samsung.com (Postfix) with ESMTP id 32C7227006C; Fri, 20 Apr 2012 16:59:13 +0200 (CEST) Date: Fri, 20 Apr 2012 16:45:27 +0200 From: Tomasz Stanislawski In-reply-to: <1334933134-4688-1-git-send-email-t.stanislaws@samsung.com> To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Message-id: <1334933134-4688-7-git-send-email-t.stanislaws@samsung.com> X-Mailer: git-send-email 1.7.9.5 References: <1334933134-4688-1-git-send-email-t.stanislaws@samsung.com> Cc: pawel@osciak.com, sumit.semwal@ti.com, linux-doc@vger.kernel.org, mchehab@redhat.com, robdclark@gmail.com, linaro-mm-sig@lists.linaro.org, kyungmin.park@samsung.com, airlied@redhat.com, remi@remlab.net, g.liakhovetski@gmx.de Subject: [Linaro-mm-sig] [PATCHv5 06/13] v4l: vb2-dma-contig: Remove unneeded allocation context structure X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Unified memory management interest group." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linaro-mm-sig-bounces@lists.linaro.org Errors-To: linaro-mm-sig-bounces@lists.linaro.org X-Gm-Message-State: ALoCoQl+D0sboEnXtHPUhrO44YqYW4UD+yGUvFjYwRsWjrxaGjNOV0+g1VxNs9j624vv5ZfZvY7/ vb2-dma-contig returns a vb2_dc_conf structure instance as the vb2 allocation context. That structure only stores a pointer to the physical device. Remove it and use the device pointer directly as the allocation context. Signed-off-by: Tomasz Stanislawski Acked-by: Laurent Pinchart --- drivers/media/video/videobuf2-dma-contig.c | 29 ++++++--------------------- 1 files changed, 7 insertions(+), 22 deletions(-) diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index 5207eb1..ff0a662 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -17,12 +17,8 @@ #include #include -struct vb2_dc_conf { - struct device *dev; -}; - struct vb2_dc_buf { - struct vb2_dc_conf *conf; + struct device *dev; void *vaddr; dma_addr_t dma_addr; unsigned long size; @@ -35,23 +31,21 @@ static void vb2_dc_put(void *buf_priv); static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size) { - struct vb2_dc_conf *conf = alloc_ctx; + struct device *dev = alloc_ctx; struct vb2_dc_buf *buf; buf = kzalloc(sizeof *buf, GFP_KERNEL); if (!buf) return ERR_PTR(-ENOMEM); - buf->vaddr = dma_alloc_coherent(conf->dev, size, &buf->dma_addr, - GFP_KERNEL); + buf->vaddr = dma_alloc_coherent(dev, size, &buf->dma_addr, GFP_KERNEL); if (!buf->vaddr) { - dev_err(conf->dev, "dma_alloc_coherent of size %ld failed\n", - size); + dev_err(dev, "dma_alloc_coherent of size %ld failed\n", size); kfree(buf); return ERR_PTR(-ENOMEM); } - buf->conf = conf; + buf->dev = dev; buf->size = size; buf->handler.refcount = &buf->refcount; @@ -68,7 +62,7 @@ static void vb2_dc_put(void *buf_priv) struct vb2_dc_buf *buf = buf_priv; if (atomic_dec_and_test(&buf->refcount)) { - dma_free_coherent(buf->conf->dev, buf->size, buf->vaddr, + dma_free_coherent(buf->dev, buf->size, buf->vaddr, buf->dma_addr); kfree(buf); } @@ -162,21 +156,12 @@ EXPORT_SYMBOL_GPL(vb2_dma_contig_memops); void *vb2_dma_contig_init_ctx(struct device *dev) { - struct vb2_dc_conf *conf; - - conf = kzalloc(sizeof *conf, GFP_KERNEL); - if (!conf) - return ERR_PTR(-ENOMEM); - - conf->dev = dev; - - return conf; + return dev; } EXPORT_SYMBOL_GPL(vb2_dma_contig_init_ctx); void vb2_dma_contig_cleanup_ctx(void *alloc_ctx) { - kfree(alloc_ctx); } EXPORT_SYMBOL_GPL(vb2_dma_contig_cleanup_ctx);