From patchwork Wed Jul 28 13:08:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Figo.zhang" X-Patchwork-Id: 114760 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6SD9thR025927 for ; Wed, 28 Jul 2010 13:09:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752421Ab0G1NJy (ORCPT ); Wed, 28 Jul 2010 09:09:54 -0400 Received: from mail-pz0-f46.google.com ([209.85.210.46]:58267 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751225Ab0G1NJx (ORCPT ); Wed, 28 Jul 2010 09:09:53 -0400 Received: by pzk26 with SMTP id 26so1795087pzk.19 for ; Wed, 28 Jul 2010 06:09:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :in-reply-to:references:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; bh=Xk6gHYcPANx7t9NSfbKRyVzR1zVEA6oggIXy8awZcCM=; b=WzUym5G443U8A+w4Krd437goo+VFTExpYFWOZNeWG2NjULw6ZIOh7xcRKqJl3ZdCXA 3Ku6VLuVW1E7fZitNs5pfJXUbGyQXJ1dHhC6Xx0KnwX4P/oN4ZNf06Q0tOPpnpH/Ysq6 aCQQBV4lXjR+XqWH8eMyNTkzyVpbFIcdw735I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; b=eoDcvy232EmtbrF8gki+mvSPwKZx2LvC2joVhm3rFWjT/t7YT1lvLmblmNjSFwyy5K Om1vzp4sVLC3VjFpMFXcBhitksSKf/ZuhAUfnHCHAQj+JqN/M0N3T9e9QtH3yH8HBhm1 qzi9s5sen2Gt0/kouW+AR5uOsjfyLuw/geHzk= Received: by 10.114.158.3 with SMTP id g3mr15258355wae.160.1280322592518; Wed, 28 Jul 2010 06:09:52 -0700 (PDT) Received: from [192.168.1.100] ([118.133.169.28]) by mx.google.com with ESMTPS id s5sm11131997wak.12.2010.07.28.06.09.49 (version=SSLv3 cipher=RC4-MD5); Wed, 28 Jul 2010 06:09:51 -0700 (PDT) Subject: [PATCH v2]videobuf_dma_sg: a new implementation for mmap From: "Figo.zhang" To: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , linux-media , Laurent Pinchart In-Reply-To: <1280321854.13781.6.camel@localhost.localdomain> References: <1280233300.2628.8.camel@localhost.localdomain> <1280321854.13781.6.camel@localhost.localdomain> Date: Wed, 28 Jul 2010 21:08:24 +0800 Message-ID: <1280322504.13781.7.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.30.2 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 28 Jul 2010 13:09:56 +0000 (UTC) diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c index 8359e6b..767483d 100644 --- a/drivers/media/video/videobuf-dma-sg.c +++ b/drivers/media/video/videobuf-dma-sg.c @@ -201,10 +201,11 @@ int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction, dprintk(1, "init kernel [%d pages]\n", nr_pages); dma->direction = direction; - dma->vmalloc = vmalloc_32(nr_pages << PAGE_SHIFT); - if (NULL == dma->vmalloc) { - dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages); - return -ENOMEM; + if (!dma->vmalloc) + dma->vmalloc = vmalloc_32(nr_pages << PAGE_SHIFT); + if (NULL == dma->vmalloc) { + dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages); + return -ENOMEM; }