From patchwork Wed Jul 28 12:57:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Figo.zhang" X-Patchwork-Id: 114758 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 o6SCxD6f023898 for ; Wed, 28 Jul 2010 12:59:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752309Ab0G1M7L (ORCPT ); Wed, 28 Jul 2010 08:59:11 -0400 Received: from mail-pw0-f46.google.com ([209.85.160.46]:62373 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752099Ab0G1M7J (ORCPT ); Wed, 28 Jul 2010 08:59:09 -0400 Received: by pwi5 with SMTP id 5so851611pwi.19 for ; Wed, 28 Jul 2010 05:59:08 -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=bELjr8Enqc0LlHy0fewMvutdGvbCvBTrw8s9rnRRIEA=; b=oXVSMzbvyhyNvUN5ugjMYEMMmDc58HA47hMoaR4MpzrayR8lnF1Q5aDA0CfbRgesw+ fZk5YbVwjzWVlWFtlykSj7qtQz6JDPqaTRNrMvfqQBW/DogmMMDqbMm9XmVpc/NWe080 bFU4GHzecSMAY4CofrPPUb/vgfMZtbED2QtXw= 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=aeYrkgSHWXGRJ2M4GfOrsQAfPsSoGYK0+V3jHPITl/rdg2LHSPWbl7xOvEMpehWYqJ mR6aOcmu6Oq+clOyZVh4O/tCQ7MHMITFJLIU/s7QD02c33TgXapuqrewHO5Wrbqpj5Fc Azem03vg/z4fAfRva+BXwYHuV+6gmmx3k0B7Y= Received: by 10.114.94.18 with SMTP id r18mr15178644wab.191.1280321948630; Wed, 28 Jul 2010 05:59:08 -0700 (PDT) Received: from [192.168.1.100] ([118.133.169.28]) by mx.google.com with ESMTPS id d39sm11113228wam.16.2010.07.28.05.59.00 (version=SSLv3 cipher=RC4-MD5); Wed, 28 Jul 2010 05:59:05 -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: <1280233300.2628.8.camel@localhost.localdomain> References: <1280233300.2628.8.camel@localhost.localdomain> Date: Wed, 28 Jul 2010 20:57:34 +0800 Message-ID: <1280321854.13781.6.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 12:59:13 +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; }