From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932265AbVH3SkZ (ORCPT ); Tue, 30 Aug 2005 14:40:25 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932262AbVH3SkZ (ORCPT ); Tue, 30 Aug 2005 14:40:25 -0400 Received: from ra.tuxdriver.com ([24.172.12.4]:32267 "EHLO ra.tuxdriver.com") by vger.kernel.org with ESMTP id S932256AbVH3SkY (ORCPT ); Tue, 30 Aug 2005 14:40:24 -0400 Date: Tue, 30 Aug 2005 14:40:06 -0400 From: "John W. Linville" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , discuss@x86-64.org, tony.luck@intel.com, linux-ia64@vger.kernel.org, Asit.K.Mallick@intel.com Subject: [rfc patch] swiotlb: consolidate swiotlb_sync_sg_* implementations Message-ID: <20050830184006.GG18998@tuxdriver.com> Mail-Followup-To: linux-kernel@vger.kernel.org, Andi Kleen , discuss@x86-64.org, tony.luck@intel.com, linux-ia64@vger.kernel.org, Asit.K.Mallick@intel.com References: <20050830180912.GE18998@tuxdriver.com> <20050830183337.GF18998@tuxdriver.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050830183337.GF18998@tuxdriver.com> User-Agent: Mutt/1.4.1i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 30, 2005 at 02:33:39PM -0400, John W. Linville wrote: > On Tue, Aug 30, 2005 at 02:09:14PM -0400, John W. Linville wrote: > > On Tue, Aug 30, 2005 at 11:03:35AM -0700, Luck, Tony wrote: > > > > > > >+swiotlb_sync_single_range_for_cpu(struct device *hwdev, > > > >+swiotlb_sync_single_range_for_device(struct device *hwdev, > > > > > > Huh? These look identical ... same args, same code, just a > > > different name. > > > > Have you looked at the implementations for swiotlb_sync_single_for_cpu > > and swiotlb_sync_single_for_device? Those are already identical. > > How about a patch like this? Just for comment...I'll repost if people > want it... Probably should include the swiotlb_sync_sg_* variations too... Whaddya think? Again, I'll repost if this is viewed favorably. John --- linux-8_29_2005/arch/ia64/lib/swiotlb.c.orig 2005-08-30 14:35:35.000000000 -0400 +++ linux-8_29_2005/arch/ia64/lib/swiotlb.c 2005-08-30 14:37:05.000000000 -0400 @@ -612,9 +612,9 @@ swiotlb_unmap_sg(struct device *hwdev, s * The same as swiotlb_sync_single_* but for a scatter-gather list, same rules * and usage. */ -void -swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg, - int nelems, int dir) +static inline void +swiotlb_sync_sg(struct device *hwdev, struct scatterlist *sg, + int nelems, int dir) { int i; @@ -628,18 +628,17 @@ swiotlb_sync_sg_for_cpu(struct device *h } void +swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg, + int nelems, int dir) +{ + swiotlb_sync_sg(hwdev, sg, nelems, dir); +} + +void swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg, int nelems, int dir) { - int i; - - if (dir == DMA_NONE) - BUG(); - - for (i = 0; i < nelems; i++, sg++) - if (sg->dma_address != SG_ENT_PHYS_ADDRESS(sg)) - sync_single(hwdev, (void *) sg->dma_address, - sg->dma_length, dir); + swiotlb_sync_sg(hwdev, sg, nelems, dir); } int -- John W. Linville linville@tuxdriver.com