lkml.org 
[lkml]   [2008]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 07/10] x86: add checks for alloc/free_coherent code
On Sat, Nov 22, 2008 at 12:27:42PM +0900, FUJITA Tomonori wrote:
> On Fri, 21 Nov 2008 17:26:07 +0100
> Joerg Roedel <joerg.roedel@amd.com> wrote:
> > +void debug_alloc_coherent(struct device *dev, size_t size,
> > + dma_addr_t dma_addr, void *virt)
> > +{
> > + unsigned long flags;
> > + struct dma_debug_entry *entry;
> > +
> > + if (dma_addr == bad_dma_address)
> > + return;
> > +
> > + entry = dma_entry_alloc();
> > + if (!entry)
> > + return;
> > +
> > + entry->type = DMA_DEBUG_COHERENT;
> > + entry->dev = dev;
> > + entry->cpu_addr = virt;
> > + entry->size = size;
> > + entry->dev_addr = dma_addr;
> > + entry->direction = DMA_BIDIRECTIONAL;
> > +
> > + spin_lock_irqsave(&dma_lock, flags);
> > + add_dma_entry(entry);
> > + spin_unlock_irqrestore(&dma_lock, flags);
> > +}
> > +EXPORT_SYMBOL(debug_alloc_coherent);
>
> Can you clean up the duplication in debug_map_single, debug_map_sg,
> and debug_alloc_coherent? The higher-level helper functions might
> help.

Hmm, lets see. For me it makes only sense if it won't result in helper
functions with tons of parameters. This is worse than little code
duplication. But lets see.

Joerg



\
 
 \ /
  Last update: 2008-11-22 10:41    [W:0.315 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site