Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1803799imu; Fri, 14 Dec 2018 00:26:35 -0800 (PST) X-Google-Smtp-Source: AFSGD/WwCWyNa/OvRqm3ehn7rLXmU5S8Qb0lMMzIkmUjJO6RAX8UvvwBPKDoOqd8N5DVYWT8OKFU X-Received: by 2002:a17:902:142:: with SMTP id 60mr2073556plb.330.1544775995124; Fri, 14 Dec 2018 00:26:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544775995; cv=none; d=google.com; s=arc-20160816; b=Ivv8Fly2LeAd7AG4CLNWyLIascBFc0nuFq8vUdYaEUxtBsZUk+MM4gTA1WVOVAiTw3 fMfnPtSNCi3gKofezjYu5UmE+9NBpFGmdFcs4lmglLFkvVWHxX8MD2q5s6m0VOm+rf8H 3kq6N7kiN7uyA4ZpLyt8BHaZNg0uynlaCMdllRm216zkC7fDJloOa52uBlx6H9IahmcH ML9kMEGshVJykojKKWnn8s3ALXfWGLZFu9zZoHWgax6KH291qhtzROjJU1rI+zH+kFNL YFNlnaqEBzagPhynNQrzOKgrPQ9ITeGbT0qMIK7DFoSxivE3w9Awd8sOl0cTZovyYSQk mpPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aSOprGgEoMD+dgL3ebwfPKycVJcnWaVThtUGdRq18Y8=; b=NdybfBlKX6F5I+Ginx91EJtKTt1yNRzNr0f7zd+6UbTHTSJv+GXDBnOf2GgS+yGH6H cir4vn70e8/gUDOTCGUmJjuFdr655/gy7XKET0mt+WZa+h+5bXhlX9PAij83wA11jaSX 9ULjbEjc68RhEuzVBy0A4pEs8spjMCOr4Xd6+1leWqeUJ0HuCk4bK+pEeJ6OxD8zAor9 cN3q2i5Y980X+LlmlhboImn848hYq9EJZAS8KMogOr+f4aALNuerpRmLVp6lzMKtPOIc oGIfma8iUMMLy5ifnaLCmRyIrmMBPJhsMtWWEa+ViPLOnmbHko1OQlSEhda+h085SyL0 8SeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=AYdjpxw1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si3599306plx.33.2018.12.14.00.26.20; Fri, 14 Dec 2018 00:26:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=AYdjpxw1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728596AbeLNIZ0 (ORCPT + 99 others); Fri, 14 Dec 2018 03:25:26 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:47682 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728177AbeLNIZZ (ORCPT ); Fri, 14 Dec 2018 03:25:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=aSOprGgEoMD+dgL3ebwfPKycVJcnWaVThtUGdRq18Y8=; b=AYdjpxw1TG7hT4vxJUWXrP8O/L m7Oc9/dVgOdvt3+Orvs809nulka8Yh5LmBKCqRRFUv4H9aY50KJVd3NWs3B9gbQMVsjj6j7nJG1GF +/uaHSeFXbH+ui0HIbRXiDBVyMyphUQl4flLmDgUIEyJRYckQN39cEDo++LPYyGDRa94Pj1jeHLjW IizfyQeUn5yaQffBPO9Wnta7SC+s7ipAjPzA2zudfuzVRoIzajT7mXDVAphK64mrRRfiTb6RUy83D HMEcXkaJaUrA5t3fGNnhUHDvwHbZZsckuIn3CsIZJZGclWE8YWiICbdjSyXdJPKnF2Z6VaEMjyYb/ nqHcJNpw==; Received: from 089144198147.atnat0007.highway.a1.net ([89.144.198.147] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gXimh-0004m4-MY; Fri, 14 Dec 2018 08:25:24 +0000 From: Christoph Hellwig To: iommu@lists.linux-foundation.org Cc: Michal Simek , Ashutosh Dixit , linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-m68k@lists.linux-m68k.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] dma-mapping: deprecate dma_zalloc_coherent Date: Fri, 14 Dec 2018 09:25:15 +0100 Message-Id: <20181214082515.14835-3-hch@lst.de> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181214082515.14835-1-hch@lst.de> References: <20181214082515.14835-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We now always return zeroed memory from dma_alloc_coherent. Note that simply passing GFP_ZERO to dma_alloc_coherent wasn't always doing the right thing to start with given that various allocators are not backed by the page allocator and thus would ignore GFP_ZERO. Signed-off-by: Christoph Hellwig --- Documentation/DMA-API.txt | 9 --------- include/linux/dma-mapping.h | 7 ++++--- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt index 016eb6909b8a..e133ccd60228 100644 --- a/Documentation/DMA-API.txt +++ b/Documentation/DMA-API.txt @@ -58,15 +58,6 @@ specify the ``GFP_`` flags (see kmalloc()) for the allocation (the implementation may choose to ignore flags that affect the location of the returned memory, like GFP_DMA). -:: - - void * - dma_zalloc_coherent(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t flag) - -Wraps dma_alloc_coherent() and also zeroes the returned memory if the -allocation attempt succeeded. - :: void diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index f422aec0f53c..a52c6409bdc2 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -644,12 +644,13 @@ static inline unsigned long dma_max_pfn(struct device *dev) } #endif +/* + * Please always use dma_alloc_coherent instead as it already zeroes the memory! + */ static inline void *dma_zalloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag) { - void *ret = dma_alloc_coherent(dev, size, dma_handle, - flag | __GFP_ZERO); - return ret; + return dma_alloc_coherent(dev, size, dma_handle, flag); } static inline int dma_get_cache_alignment(void) -- 2.19.2