Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 23685
b: refs/heads/master
c: 3481454
h: refs/heads/master
i:
  23683: 431708a
v: v3
  • Loading branch information
Eric Sesterhenn authored and Adrian Bunk committed Mar 24, 2006
1 parent 3c79b63 commit 351d21d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6978c7052f2e22c6c40781cdd4eba5c4bce9a789
refs/heads/master: 34814545890db603b7648ea2ea477d1f83b61297
32 changes: 12 additions & 20 deletions trunk/lib/swiotlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,7 @@ map_single(struct device *hwdev, char *buffer, size_t size, int dir)
else
stride = 1;

if (!nslots)
BUG();
BUG_ON(!nslots);

/*
* Find suitable number of IO TLB entries size that will fit this
Expand Down Expand Up @@ -416,14 +415,14 @@ sync_single(struct device *hwdev, char *dma_addr, size_t size,
case SYNC_FOR_CPU:
if (likely(dir == DMA_FROM_DEVICE || dir == DMA_BIDIRECTIONAL))
memcpy(buffer, dma_addr, size);
else if (dir != DMA_TO_DEVICE)
BUG();
else
BUG_ON(dir != DMA_TO_DEVICE);
break;
case SYNC_FOR_DEVICE:
if (likely(dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL))
memcpy(dma_addr, buffer, size);
else if (dir != DMA_FROM_DEVICE)
BUG();
else
BUG_ON(dir != DMA_FROM_DEVICE);
break;
default:
BUG();
Expand Down Expand Up @@ -529,8 +528,7 @@ swiotlb_map_single(struct device *hwdev, void *ptr, size_t size, int dir)
unsigned long dev_addr = virt_to_phys(ptr);
void *map;

if (dir == DMA_NONE)
BUG();
BUG_ON(dir == DMA_NONE);
/*
* If the pointer passed in happens to be in the device's DMA window,
* we can safely return the device addr and not worry about bounce
Expand Down Expand Up @@ -592,8 +590,7 @@ swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr, size_t size,
{
char *dma_addr = phys_to_virt(dev_addr);

if (dir == DMA_NONE)
BUG();
BUG_ON(dir == DMA_NONE);
if (dma_addr >= io_tlb_start && dma_addr < io_tlb_end)
unmap_single(hwdev, dma_addr, size, dir);
else if (dir == DMA_FROM_DEVICE)
Expand All @@ -616,8 +613,7 @@ swiotlb_sync_single(struct device *hwdev, dma_addr_t dev_addr,
{
char *dma_addr = phys_to_virt(dev_addr);

if (dir == DMA_NONE)
BUG();
BUG_ON(dir == DMA_NONE);
if (dma_addr >= io_tlb_start && dma_addr < io_tlb_end)
sync_single(hwdev, dma_addr, size, dir, target);
else if (dir == DMA_FROM_DEVICE)
Expand Down Expand Up @@ -648,8 +644,7 @@ swiotlb_sync_single_range(struct device *hwdev, dma_addr_t dev_addr,
{
char *dma_addr = phys_to_virt(dev_addr) + offset;

if (dir == DMA_NONE)
BUG();
BUG_ON(dir == DMA_NONE);
if (dma_addr >= io_tlb_start && dma_addr < io_tlb_end)
sync_single(hwdev, dma_addr, size, dir, target);
else if (dir == DMA_FROM_DEVICE)
Expand Down Expand Up @@ -696,8 +691,7 @@ swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nelems,
unsigned long dev_addr;
int i;

if (dir == DMA_NONE)
BUG();
BUG_ON(dir == DMA_NONE);

for (i = 0; i < nelems; i++, sg++) {
addr = SG_ENT_VIRT_ADDRESS(sg);
Expand Down Expand Up @@ -730,8 +724,7 @@ swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nelems,
{
int i;

if (dir == DMA_NONE)
BUG();
BUG_ON(dir == DMA_NONE);

for (i = 0; i < nelems; i++, sg++)
if (sg->dma_address != SG_ENT_PHYS_ADDRESS(sg))
Expand All @@ -753,8 +746,7 @@ swiotlb_sync_sg(struct device *hwdev, struct scatterlist *sg,
{
int i;

if (dir == DMA_NONE)
BUG();
BUG_ON(dir == DMA_NONE);

for (i = 0; i < nelems; i++, sg++)
if (sg->dma_address != SG_ENT_PHYS_ADDRESS(sg))
Expand Down

0 comments on commit 351d21d

Please sign in to comment.