Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2553387imu; Fri, 23 Nov 2018 10:55:25 -0800 (PST) X-Google-Smtp-Source: AFSGD/V4Sx+oEZW6+pzYt4LoJThaJQroIO11RuptynOrRq1ze9kGDjCrUBj9dB2y8ORVgOIcHZp8 X-Received: by 2002:a17:902:1681:: with SMTP id h1mr16973936plh.129.1542999325135; Fri, 23 Nov 2018 10:55:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542999325; cv=none; d=google.com; s=arc-20160816; b=ki/GIVKOl7BcSkOcPd5CJSNOMNeHNtR8xesu+gnVVkioG4zEToSDgri8xVk6+9Ke2E Zd/GrGDkgmz8G4/6J94ln/s6VlWj7QkEUIVODiXlewLobkI2nqdRJ3fYsvn7v1IYHOZU qdUzgYacDeGBJ1C9xzccH7ZYmdhtgWogLYD1dQqlGUZJQd8WhHC+9opzpdxRbheL+U9j ye+9JJEeb/S6e49CGuVG4FMpMLH+LpWeRmrytv3n9LBTSCm8BBykXbSOyrF8ATya+4T8 paOVzFGU522zMExkNGM0eJh4Hwxdnu6uVWzOTjCaFUfvbyZ6hKb86u0lmLzSIdh9NfSO Xu9Q== 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=ddSc0GEXTciULelNE8dEV/Abh7889SvikaXoFrcrdpo=; b=WqK7nqsDA3f88T6UaT2k+QRupcv54r34M5N9PQgWh5iA0Ep05O7WR8INzKhGjMvgKw JBbEXlAYQUprI8NhypH713rzTDts17xH+0pshVGx0KWjYd7Kb1ZgbGhpWW912gX7J2Y0 HJpLYhP5beW14DGX1FwfS+6HIyPM8jovKE2o0KT+PyuEQBNr76y02pyXqCOQm048cnaQ 6mq/5neYeAkqQkiyjOvceGo44Pr2kCl4cCifF2Gb8eGe8A5ORFzyYdcMPTuMai13BFQx biXMjUJYJZkzdeXPDalXahixADfCvXrhmzkE1jBhAXhBHn+LBryYF73CNR51dMko7/TZ 3DfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=WFTGG4iX; 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 b26si24992008pgl.539.2018.11.23.10.55.09; Fri, 23 Nov 2018 10:55:25 -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=WFTGG4iX; 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 S2437153AbeKWAn2 (ORCPT + 99 others); Thu, 22 Nov 2018 19:43:28 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:57516 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391646AbeKWAn0 (ORCPT ); Thu, 22 Nov 2018 19:43:26 -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=ddSc0GEXTciULelNE8dEV/Abh7889SvikaXoFrcrdpo=; b=WFTGG4iXQnXhmYXV0fS89aw1Ji wpoi3FyQfZERrWk5YYIAohdZfj6iZlI7ZmcRs2z+bfgnIsvTcv/T/d4m56ORGKsDoXCWoT4BgAIXr VoKZ+5cttlWu7z6szNWL2ksWAoB6cnvwe95PuA+y6blxOlJLFGSkQ132y/KD4cLCOPzbgnGjdA8FA V76OZCUOOxHgteuZ/E1vbCUJLthECQ18brpUP2VFP4amEbZY+aDbi/BR8R9esy9TXPm5DRIttuGkz +ipXstlftvFU32dkoRwpm8iLMosgAANejBoaWrVjVBfp170QATBBQsbY/7vIgXH1UVBiZTwj4k4ff t9GmmgbA==; Received: from clnet-p19-102.ikbnet.co.at ([83.175.77.102] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPpa5-0007w1-7s; Thu, 22 Nov 2018 14:03:45 +0000 From: Christoph Hellwig To: iommu@lists.linux-foundation.org Cc: Linus Torvalds , Jon Mason , Joerg Roedel , David Woodhouse , Marek Szyprowski , Robin Murphy , x86@kernel.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org, xen-devel@lists.xenproject.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/24] mips/jazz: remove the mapping_error dma_map_ops method Date: Thu, 22 Nov 2018 15:03:03 +0100 Message-Id: <20181122140320.24080-8-hch@lst.de> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181122140320.24080-1-hch@lst.de> References: <20181122140320.24080-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 The Jazz iommu code already returns (~(dma_addr_t)0x0) on mapping failures, so we can switch over to returning DMA_MAPPING_ERROR and let the core dma-mapping code handle the rest. Signed-off-by: Christoph Hellwig --- arch/mips/include/asm/jazzdma.h | 6 ------ arch/mips/jazz/jazzdma.c | 16 +++++----------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/arch/mips/include/asm/jazzdma.h b/arch/mips/include/asm/jazzdma.h index d913439c738c..d13f940022d5 100644 --- a/arch/mips/include/asm/jazzdma.h +++ b/arch/mips/include/asm/jazzdma.h @@ -39,12 +39,6 @@ extern int vdma_get_enable(int channel); #define VDMA_PAGE(a) ((unsigned int)(a) >> 12) #define VDMA_OFFSET(a) ((unsigned int)(a) & (VDMA_PAGESIZE-1)) -/* - * error code returned by vdma_alloc() - * (See also arch/mips/kernel/jazzdma.c) - */ -#define VDMA_ERROR 0xffffffff - /* * VDMA pagetable entry description */ diff --git a/arch/mips/jazz/jazzdma.c b/arch/mips/jazz/jazzdma.c index 4c41ed0a637e..6256d35dbf4d 100644 --- a/arch/mips/jazz/jazzdma.c +++ b/arch/mips/jazz/jazzdma.c @@ -104,12 +104,12 @@ unsigned long vdma_alloc(unsigned long paddr, unsigned long size) if (vdma_debug) printk("vdma_alloc: Invalid physical address: %08lx\n", paddr); - return VDMA_ERROR; /* invalid physical address */ + return DMA_MAPPING_ERROR; /* invalid physical address */ } if (size > 0x400000 || size == 0) { if (vdma_debug) printk("vdma_alloc: Invalid size: %08lx\n", size); - return VDMA_ERROR; /* invalid physical address */ + return DMA_MAPPING_ERROR; /* invalid physical address */ } spin_lock_irqsave(&vdma_lock, flags); @@ -123,7 +123,7 @@ unsigned long vdma_alloc(unsigned long paddr, unsigned long size) first < VDMA_PGTBL_ENTRIES) first++; if (first + pages > VDMA_PGTBL_ENTRIES) { /* nothing free */ spin_unlock_irqrestore(&vdma_lock, flags); - return VDMA_ERROR; + return DMA_MAPPING_ERROR; } last = first + 1; @@ -569,7 +569,7 @@ static void *jazz_dma_alloc(struct device *dev, size_t size, return NULL; *dma_handle = vdma_alloc(virt_to_phys(ret), size); - if (*dma_handle == VDMA_ERROR) { + if (*dma_handle == DMA_MAPPING_ERROR) { dma_direct_free_pages(dev, size, ret, *dma_handle, attrs); return NULL; } @@ -620,7 +620,7 @@ static int jazz_dma_map_sg(struct device *dev, struct scatterlist *sglist, arch_sync_dma_for_device(dev, sg_phys(sg), sg->length, dir); sg->dma_address = vdma_alloc(sg_phys(sg), sg->length); - if (sg->dma_address == VDMA_ERROR) + if (sg->dma_address == DMA_MAPPING_ERROR) return 0; sg_dma_len(sg) = sg->length; } @@ -674,11 +674,6 @@ static void jazz_dma_sync_sg_for_cpu(struct device *dev, arch_sync_dma_for_cpu(dev, sg_phys(sg), sg->length, dir); } -static int jazz_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) -{ - return dma_addr == VDMA_ERROR; -} - const struct dma_map_ops jazz_dma_ops = { .alloc = jazz_dma_alloc, .free = jazz_dma_free, @@ -692,6 +687,5 @@ const struct dma_map_ops jazz_dma_ops = { .sync_sg_for_device = jazz_dma_sync_sg_for_device, .dma_supported = dma_direct_supported, .cache_sync = arch_dma_cache_sync, - .mapping_error = jazz_dma_mapping_error, }; EXPORT_SYMBOL(jazz_dma_ops); -- 2.19.1