--- drivers/dma/dmaengine.c | 6 ++---- include/linux/dmaengine.h | 16 ++++++---------- 2 files changed, 8 insertions(+), 14 deletions(-) Index: linux-2.6/include/linux/dmaengine.h =================================================================== --- linux-2.6.orig/include/linux/dmaengine.h 2007-11-19 14:09:46.655173372 -0800 +++ linux-2.6/include/linux/dmaengine.h 2007-11-19 14:37:07.162913558 -0800 @@ -102,13 +102,13 @@ typedef struct { DECLARE_BITMAP(bits, DM /** * struct dma_chan_percpu - the per-CPU part of struct dma_chan - * @refcount: local_t used for open-coded "bigref" counting + * @refcount: int used for open-coded "bigref" counting * @memcpy_count: transaction counter * @bytes_transferred: byte counter */ struct dma_chan_percpu { - local_t refcount; + int refcount; /* stats */ unsigned long memcpy_count; unsigned long bytes_transferred; @@ -149,20 +149,16 @@ static inline void dma_chan_get(struct d { if (unlikely(chan->slow_ref)) kref_get(&chan->refcount); - else { - local_inc(&CPU_PTR(chan->local, get_cpu())->refcount); - put_cpu(); - } + else + _CPU_INC(chan->local->refcount); } static inline void dma_chan_put(struct dma_chan *chan) { if (unlikely(chan->slow_ref)) kref_put(&chan->refcount, dma_chan_cleanup); - else { - local_dec(&CPU_PTR(chan->local, get_cpu())->refcount); - put_cpu(); - } + else + _CPU_DEC(chan->local->refcount); } /* Index: linux-2.6/drivers/dma/dmaengine.c =================================================================== --- linux-2.6.orig/drivers/dma/dmaengine.c 2007-11-19 14:10:34.749923161 -0800 +++ linux-2.6/drivers/dma/dmaengine.c 2007-11-19 14:11:57.790422830 -0800 @@ -110,10 +110,8 @@ static ssize_t show_in_use(struct class_ atomic_read(&chan->refcount.refcount) > 1) in_use = 1; else { - if (local_read(&(CPU_PTR(chan->local, - get_cpu())->refcount)) > 0) + if (_CPU_READ(chan->local->refcount) > 0) in_use = 1; - put_cpu(); } return sprintf(buf, "%d\n", in_use); @@ -226,7 +224,7 @@ static void dma_chan_free_rcu(struct rcu int bias = 0x7FFFFFFF; int i; for_each_possible_cpu(i) - bias -= local_read(&CPU_PTR(chan->local, i)->refcount); + bias -= _CPU_READ(chan->local->refcount); atomic_sub(bias, &chan->refcount.refcount); kref_put(&chan->refcount, dma_chan_cleanup); }