From patchwork Thu Apr 5 14:00:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Stanislawski X-Patchwork-Id: 7680 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 6EB8D23ECD for ; Thu, 5 Apr 2012 14:00:59 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 3FABBA18AFE for ; Thu, 5 Apr 2012 14:00:59 +0000 (UTC) Received: by mail-yx0-f180.google.com with SMTP id l4so854307yen.11 for ; Thu, 05 Apr 2012 07:00:59 -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:date:from :in-reply-to:to:message-id:mime-version: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=4HtpV+R+e7HZ6Nd3z9KEwao7L+3GL9SOc9hlVuJ0FtE=; b=ThidWhh/zPTCnLbYIKepu4syunRlhLB/jIEQ+CvyVoQYr27MUcEUksatrJdVt/sehz m7SzkA18pDOIgPJApbWUa34lI8Ly/XAoCPSFS3XagNM6cw1VS4aE1SFDbyLMMdaMZ/9s vnGWxj4g/auNTiIHNt59YuJ+RXwOpcK7a3C6fW7AIy3X12J6d87uvHcfszKM5aD4Cncb UwhZoBv0QBx7lceQhEZx8G72alhYBx8eCwrUOJb8aJXM33CaHTid7u2Sohel5SGwS/AC iaPpSKR1vYk43lkjLvG1eViwQRNYuBihupDIbbPWBTTK+uEyVyHGxSie4LiG46LZhwZ7 m92A== Received: by 10.50.51.197 with SMTP id m5mr2026220igo.38.1333634458714; Thu, 05 Apr 2012 07:00:58 -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.164.217 with SMTP id f25csp61181iby; Thu, 5 Apr 2012 07:00:52 -0700 (PDT) Received: by 10.216.137.156 with SMTP id y28mr1757536wei.61.1333634446170; Thu, 05 Apr 2012 07:00:46 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id j10si4399601wed.143.2012.04.05.07.00.44; Thu, 05 Apr 2012 07:00:46 -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 1SFnEy-0005Mu-Cn; Thu, 05 Apr 2012 14:00:44 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SFnEp-0003qt-FL for linaro-mm-sig@lists.linaro.org; Thu, 05 Apr 2012 14:00:35 +0000 Received: from euspt1 (mailout1.w1.samsung.com [210.118.77.11]) by mailout1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTP id <0M2000EZCEVKCR@mailout1.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Thu, 05 Apr 2012 14:59:44 +0100 (BST) Received: from linux.samsung.com ([106.116.38.10]) by spt1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0M2000D6EEWVUI@spt1.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Thu, 05 Apr 2012 15:00:32 +0100 (BST) Received: from mcdsrvbld02.digital.local (unknown [106.116.37.23]) by linux.samsung.com (Postfix) with ESMTP id 0A801270094; Thu, 05 Apr 2012 16:07:23 +0200 (CEST) Date: Thu, 05 Apr 2012 16:00:03 +0200 From: Tomasz Stanislawski In-reply-to: <1333634408-4960-1-git-send-email-t.stanislaws@samsung.com> To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Message-id: <1333634408-4960-7-git-send-email-t.stanislaws@samsung.com> MIME-version: 1.0 X-Mailer: git-send-email 1.7.9.1 References: <1333634408-4960-1-git-send-email-t.stanislaws@samsung.com> Cc: pawel@osciak.com, sumit.semwal@ti.com, robdclark@gmail.com, linaro-mm-sig@lists.linaro.org, kyungmin.park@samsung.com, airlied@redhat.com Subject: [Linaro-mm-sig] [PATCH 06/11] 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: ALoCoQm+Qq8d1DEcaSXqf98zqaf3MX2a2KdtqdgO04z48eJSwkAVa87WINAVpuMmlULAcCnKDH2p 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 --- 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);