ia64/xen-unstable

changeset 15169:8655f7b7d50c

[IA64] Fix bug in xen_alloc_coherent()

xen_create_contiguous_region() needs an order, not a mask. Also change
s/hwdev/dev/ for consistency.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author Alex Williamson <alex.williamson@hp.com>
date Mon Jun 11 11:21:31 2007 -0600 (2007-06-11)
parents f63349a4051d
children 154878b6ec4b
files linux-2.6-xen-sparse/arch/ia64/xen/xen_dma.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/xen_dma.c	Mon Jun 11 11:17:33 2007 -0600
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xen_dma.c	Mon Jun 11 11:21:31 2007 -0600
     1.3 @@ -22,6 +22,7 @@
     1.4   * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     1.5   */
     1.6  
     1.7 +#include <linux/bitops.h>
     1.8  #include <linux/dma-mapping.h>
     1.9  #include <linux/mm.h>
    1.10  #include <asm/scatterlist.h>
    1.11 @@ -40,18 +41,18 @@ do {								\
    1.12   * when merged with upstream Linux.
    1.13   */
    1.14  static inline int
    1.15 -address_needs_mapping(struct device *hwdev, dma_addr_t addr)
    1.16 +address_needs_mapping(struct device *dev, dma_addr_t addr)
    1.17  {
    1.18  	dma_addr_t mask = 0xffffffff;
    1.19  
    1.20  	/* If the device has a mask, use it, otherwise default to 32 bits */
    1.21 -	if (hwdev && hwdev->dma_mask)
    1.22 -		mask = *hwdev->dma_mask;
    1.23 +	if (dev && dev->dma_mask)
    1.24 +		mask = *dev->dma_mask;
    1.25  	return (addr & ~mask) != 0;
    1.26  }
    1.27  
    1.28  int
    1.29 -xen_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
    1.30 +xen_map_sg(struct device *dev, struct scatterlist *sg, int nents,
    1.31  	   int direction)
    1.32  {
    1.33  	int i;
    1.34 @@ -60,7 +61,7 @@ xen_map_sg(struct device *hwdev, struct 
    1.35  		sg[i].dma_address = page_to_bus(sg[i].page) + sg[i].offset;
    1.36  		sg[i].dma_length  = sg[i].length;
    1.37  
    1.38 -		IOMMU_BUG_ON(address_needs_mapping(hwdev, sg[i].dma_address));
    1.39 +		IOMMU_BUG_ON(address_needs_mapping(dev, sg[i].dma_address));
    1.40  	}
    1.41  
    1.42  	return nents;
    1.43 @@ -68,7 +69,7 @@ xen_map_sg(struct device *hwdev, struct 
    1.44  EXPORT_SYMBOL(xen_map_sg);
    1.45  
    1.46  void
    1.47 -xen_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
    1.48 +xen_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
    1.49  	     int direction)
    1.50  {
    1.51  }
    1.52 @@ -101,7 +102,7 @@ xen_alloc_coherent(struct device *dev, s
    1.53  		return NULL;
    1.54  
    1.55  	if (xen_create_contiguous_region(vaddr, order,
    1.56 -					 dev->coherent_dma_mask)) {
    1.57 +					 fls64(dev->coherent_dma_mask))) {
    1.58  		free_pages(vaddr, order);
    1.59  		return NULL;
    1.60  	}