diff options
-rw-r--r-- | sys/alpha/alpha/busdma_machdep.c | 8 | ||||
-rw-r--r-- | sys/amd64/amd64/busdma_machdep.c | 8 | ||||
-rw-r--r-- | sys/i386/i386/busdma_machdep.c | 8 | ||||
-rw-r--r-- | sys/ia64/ia64/busdma_machdep.c | 8 | ||||
-rw-r--r-- | sys/powerpc/powerpc/busdma_machdep.c | 8 | ||||
-rw-r--r-- | sys/sparc64/sparc64/bus_machdep.c | 5 |
6 files changed, 23 insertions, 22 deletions
diff --git a/sys/alpha/alpha/busdma_machdep.c b/sys/alpha/alpha/busdma_machdep.c index 2075053..0b9ed6d 100644 --- a/sys/alpha/alpha/busdma_machdep.c +++ b/sys/alpha/alpha/busdma_machdep.c @@ -42,6 +42,7 @@ #include <vm/vm_page.h> #include <vm/vm_map.h> +#include <machine/atomic.h> #include <machine/bus.h> #include <machine/sgmap.h> #include <machine/md_var.h> @@ -179,9 +180,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); } if (newtag->lowaddr < ptoa(Maxmem) && (flags & BUS_DMA_ALLOCNOW) != 0) { @@ -228,7 +228,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); } diff --git a/sys/amd64/amd64/busdma_machdep.c b/sys/amd64/amd64/busdma_machdep.c index d431ea0..4fe748c 100644 --- a/sys/amd64/amd64/busdma_machdep.c +++ b/sys/amd64/amd64/busdma_machdep.c @@ -42,6 +42,7 @@ #include <vm/vm_page.h> #include <vm/vm_map.h> +#include <machine/atomic.h> #include <machine/bus.h> #include <machine/md_var.h> @@ -186,9 +187,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); } if (newtag->lowaddr < ptoa(Maxmem) && (flags & BUS_DMA_ALLOCNOW) != 0) { @@ -235,7 +235,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); /* diff --git a/sys/i386/i386/busdma_machdep.c b/sys/i386/i386/busdma_machdep.c index d431ea0..4fe748c 100644 --- a/sys/i386/i386/busdma_machdep.c +++ b/sys/i386/i386/busdma_machdep.c @@ -42,6 +42,7 @@ #include <vm/vm_page.h> #include <vm/vm_map.h> +#include <machine/atomic.h> #include <machine/bus.h> #include <machine/md_var.h> @@ -186,9 +187,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); } if (newtag->lowaddr < ptoa(Maxmem) && (flags & BUS_DMA_ALLOCNOW) != 0) { @@ -235,7 +235,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); /* diff --git a/sys/ia64/ia64/busdma_machdep.c b/sys/ia64/ia64/busdma_machdep.c index 9b70d6c..3feacca 100644 --- a/sys/ia64/ia64/busdma_machdep.c +++ b/sys/ia64/ia64/busdma_machdep.c @@ -41,6 +41,7 @@ #include <vm/vm_page.h> #include <vm/vm_map.h> +#include <machine/atomic.h> #include <machine/bus.h> #include <machine/md_var.h> @@ -175,9 +176,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); } if (newtag->lowaddr < ptoa(Maxmem) && (flags & BUS_DMA_ALLOCNOW) != 0) { @@ -224,7 +224,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); } 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); /* diff --git a/sys/sparc64/sparc64/bus_machdep.c b/sys/sparc64/sparc64/bus_machdep.c index 588fc8c..11f7b78 100644 --- a/sys/sparc64/sparc64/bus_machdep.c +++ b/sys/sparc64/sparc64/bus_machdep.c @@ -128,6 +128,7 @@ #include <vm/vm_map.h> #include <machine/asi.h> +#include <machine/atomic.h> #include <machine/bus.h> #include <machine/bus_private.h> #include <machine/cache.h> @@ -246,7 +247,7 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, newtag->dt_boundary = ulmin(parent->dt_boundary, newtag->dt_boundary); } - newtag->dt_parent->dt_ref_count++; + atomic_add_int(&newtag->dt_parent->dt_ref_count, 1); *dmat = newtag; return (0); @@ -262,7 +263,7 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) return (EBUSY); while (dmat != NULL) { parent = dmat->dt_parent; - dmat->dt_ref_count--; + atomic_subtract_int(&dmat->dt_ref_count, 1); if (dmat->dt_ref_count == 0) { free(dmat, M_DEVBUF); /* |