From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH 21/23] xen-swiotlb: remove the mapping_error dma_map_ops method Date: Sun, 2 Dec 2018 07:42:42 -0500 Message-ID: <20181202124241.GB3166@localhost.localdomain> References: <20181130132231.16512-1-hch@lst.de> <20181130132231.16512-22-hch@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=lEtZ8HUr5ta3aKPraRuQaLc/uiyvX7GFrTe4WWXumQI=; b=nvMrjOsPdkPMzQLlt1gunKPVHCAajsFxx0tWR6GaGF7HBlewscy+eiPaX1SQpZP/nS vnhJr27IuE7V4isA7367vYd3vuhRTsll1+3rA5gg8VyHUOcAEUjtBSRVEQw+hZYzgP1t UxYBtIpAA5c8k4TEigeoDoqu5fnoWxGrPrm603hx3H2+5NAdttbjdDWgbZsI7ovMhLSR l5IbUKsCuCwlMtSDiP4/QAo6BjTwdjHw5Bo8lY5GWkQaBUVmNu1yqTu1S4YXUes+ZsU+ JE0JiR3PKDnT7okU4ZU17FJmEdzcM2mJAs3I7t5mM82Vcjz1779tMprJlSleWYPdf9xD l9fA== Content-Disposition: inline In-Reply-To: <20181130132231.16512-22-hch-jcswGhMUV9g@public.gmane.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Christoph Hellwig Cc: linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-alpha-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-ia64-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-parisc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Linus Torvalds , x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, Robin Murphy , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, xen-devel-GuqFBffKawtpuQazS67q72D2FQJk+8+b@public.gmane.org, David Woodhouse , linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org On Fri, Nov 30, 2018 at 02:22:29PM +0100, Christoph Hellwig wrote: > Return DMA_MAPPING_ERROR instead of 0 on a dma mapping failure and let > the core dma-mapping code handle the rest. > > Signed-off-by: Christoph Hellwig Reviewed-by: Konrad Rzeszutek Wilk > --- > drivers/xen/swiotlb-xen.c | 12 ++---------- > 1 file changed, 2 insertions(+), 10 deletions(-) > > diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c > index 2a7f545bd0b5..6dc969d5ea2f 100644 > --- a/drivers/xen/swiotlb-xen.c > +++ b/drivers/xen/swiotlb-xen.c > @@ -53,8 +53,6 @@ > * API. > */ > > -#define XEN_SWIOTLB_ERROR_CODE (~(dma_addr_t)0x0) > - > static char *xen_io_tlb_start, *xen_io_tlb_end; > static unsigned long xen_io_tlb_nslabs; > /* > @@ -406,7 +404,7 @@ static dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, > map = swiotlb_tbl_map_single(dev, start_dma_addr, phys, size, dir, > attrs); > if (map == SWIOTLB_MAP_ERROR) > - return XEN_SWIOTLB_ERROR_CODE; > + return DMA_MAPPING_ERROR; > > dev_addr = xen_phys_to_bus(map); > xen_dma_map_page(dev, pfn_to_page(map >> PAGE_SHIFT), > @@ -421,7 +419,7 @@ static dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, > attrs |= DMA_ATTR_SKIP_CPU_SYNC; > swiotlb_tbl_unmap_single(dev, map, size, dir, attrs); > > - return XEN_SWIOTLB_ERROR_CODE; > + return DMA_MAPPING_ERROR; > } > > /* > @@ -700,11 +698,6 @@ xen_swiotlb_get_sgtable(struct device *dev, struct sg_table *sgt, > return dma_common_get_sgtable(dev, sgt, cpu_addr, handle, size, attrs); > } > > -static int xen_swiotlb_mapping_error(struct device *dev, dma_addr_t dma_addr) > -{ > - return dma_addr == XEN_SWIOTLB_ERROR_CODE; > -} > - > const struct dma_map_ops xen_swiotlb_dma_ops = { > .alloc = xen_swiotlb_alloc_coherent, > .free = xen_swiotlb_free_coherent, > @@ -719,5 +712,4 @@ const struct dma_map_ops xen_swiotlb_dma_ops = { > .dma_supported = xen_swiotlb_dma_supported, > .mmap = xen_swiotlb_dma_mmap, > .get_sgtable = xen_swiotlb_get_sgtable, > - .mapping_error = xen_swiotlb_mapping_error, > }; > -- > 2.19.1 >