Messages in this thread Patch in this message | | | Date | Tue, 30 Aug 2005 14:40:06 -0400 | From | "John W. Linville" <> | Subject | [rfc patch] swiotlb: consolidate swiotlb_sync_sg_* implementations |
| |
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 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |