summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authormux <mux@FreeBSD.org>2003-03-20 19:45:26 +0000
committermux <mux@FreeBSD.org>2003-03-20 19:45:26 +0000
commit09775368124d25ae2e000d454c2af679bb9e5d15 (patch)
tree676f0b2bbfa34e33239736c7054e35324eaede36 /sys/powerpc
parent81351314859e1cd7382f611ad7339acf15e2b591 (diff)
downloadFreeBSD-src-09775368124d25ae2e000d454c2af679bb9e5d15.zip
FreeBSD-src-09775368124d25ae2e000d454c2af679bb9e5d15.tar.gz
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.
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/powerpc/busdma_machdep.c8
1 files changed, 4 insertions, 4 deletions
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 <vm/vm_page.h>
#include <vm/vm_map.h>
+#include <machine/atomic.h>
#include <machine/bus.h>
#include <machine/cpufunc.h>
@@ -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);
/*
OpenPOWER on IntegriCloud