From patchwork Fri May 18 13:45:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 916357 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rAZWfibo"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40nTwK5rJmz9s33 for ; Fri, 18 May 2018 23:46:09 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=pYVrjgw2rXCUfT+XNDpg6L/X01XtUF5OY6cnCwQPFiQ=; b=rAZWfibo8pMgKPvHqsO2HESAzY JdAI5xpeh+xCtBOOmb+FcHc862oRy2HYbErl9MK6jFyc+hGvdwi8IRN6G8bc/KuBiDQBXa/NEn0vO Lcy8eUpOX4beiquJ5JmbewdqWY7tHgY7BT7wx/Iq4/X+8rHMy8CmMyXJdPJII/mcsBRtleO3eSxAc BbquAUrqY+aYnnnS8M9B+MDTUci0ajR00UyZGt4pBhusfPTqlBmU5yD0Lty2yd/1ASpYXFzu0MkTF A542WfLPwAMx+55rAQ4rNpfsnLowOQYRiRTt0yQ66NfjIcSn7zIk1TIM7ovnisw64Ojv8jgbw2oHn Qm8VLR6g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fJfhw-0006hC-9d; Fri, 18 May 2018 13:46:08 +0000 Received: from 80-109-164-210.cable.dynamic.surfer.at ([80.109.164.210] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fJfhm-0006gB-B2; Fri, 18 May 2018 13:46:06 +0000 From: Christoph Hellwig To: Alexey Brodkin , iommu@lists.linux-foundation.org Subject: [PATCH 3/6] arc: simplify arc_dma_sync_single_for_{cpu,device} Date: Fri, 18 May 2018 15:45:42 +0200 Message-Id: <20180518134545.5036-4-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180518134545.5036-1-hch@lst.de> References: <20180518134545.5036-1-hch@lst.de> X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vineet Gupta , linux-snps-arc@lists.infradead.org MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Remove the indirection through _dma_cache_sync. Also move the functions up a bit in the source file as we'll need them in more places soon. Signed-off-by: Christoph Hellwig --- arch/arc/mm/dma.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c index 1dcc404b5aec..98e21ce526be 100644 --- a/arch/arc/mm/dma.c +++ b/arch/arc/mm/dma.c @@ -153,6 +153,18 @@ static void _dma_cache_sync(phys_addr_t paddr, size_t size, } } +static void arc_dma_sync_single_for_device(struct device *dev, + dma_addr_t dma_handle, size_t size, enum dma_data_direction dir) +{ + dma_cache_wback(dma_handle, size); +} + +static void arc_dma_sync_single_for_cpu(struct device *dev, + dma_addr_t dma_handle, size_t size, enum dma_data_direction dir) +{ + dma_cache_inv(dma_handle, size); +} + /* * arc_dma_map_page - map a portion of a page for streaming DMA * @@ -221,18 +233,6 @@ static void arc_dma_unmap_sg(struct device *dev, struct scatterlist *sg, attrs); } -static void arc_dma_sync_single_for_cpu(struct device *dev, - dma_addr_t dma_handle, size_t size, enum dma_data_direction dir) -{ - _dma_cache_sync(dma_handle, size, DMA_FROM_DEVICE); -} - -static void arc_dma_sync_single_for_device(struct device *dev, - dma_addr_t dma_handle, size_t size, enum dma_data_direction dir) -{ - _dma_cache_sync(dma_handle, size, DMA_TO_DEVICE); -} - static void arc_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sglist, int nelems, enum dma_data_direction dir)