From 09775368124d25ae2e000d454c2af679bb9e5d15 Mon Sep 17 00:00:00 2001 From: mux Date: Thu, 20 Mar 2003 19:45:26 +0000 Subject: Use atomic operations to increment and decrement the refcount in busdma tags. There are currently no tags shared accross different drivers so this isn't needed at the moment, but it will be required when we'll have a proper newbus method to get the parent busdma tag. --- sys/powerpc/powerpc/busdma_machdep.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/powerpc') diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c index 6c6dd36..63fdf71 100644 --- a/sys/powerpc/powerpc/busdma_machdep.c +++ b/sys/powerpc/powerpc/busdma_machdep.c @@ -51,6 +51,7 @@ static const char rcsid[] = #include #include +#include #include #include @@ -133,9 +134,8 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, newtag->filterarg = parent->filterarg; newtag->parent = parent->parent; } - if (newtag->parent != NULL) { - parent->ref_count++; - } + if (newtag->parent != NULL) + atomic_add_int(&parent->ref_count, 1); } *dmat = newtag; @@ -154,7 +154,7 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) bus_dma_tag_t parent; parent = dmat->parent; - dmat->ref_count--; + atomic_subtract_int(&dmat->ref_count, 1); if (dmat->ref_count == 0) { free(dmat, M_DEVBUF); /* -- cgit v1.1