Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*
@@ -22,12 +22,10 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/conf.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
#include <sys/ddi_impldefs.h>
@@ -190,11 +188,11 @@
/* fill in all the test info details now */
test->mem_info = mem_info;
test->board = softsp->board;
test->bank = pkt->bank;
test->bufp = kmem_alloc(TEST_PAGESIZE, KM_SLEEP);
- test->info.handle = atomic_add_32_nv(&mem_test_sequence_id, 1);
+ test->info.handle = atomic_inc_32_nv(&mem_test_sequence_id);
(void) drv_getparm(PPID, (ulong_t *)(&(test->info.tester_pid)));
test->info.prev_condition = mem_info->condition;
test->info.page_size = TEST_PAGESIZE;
/* If Blackbird ever gets a variable line size, this will change. */
test->info.line_size = cpunodes[CPU->cpu_id].ecache_linesize;
@@ -402,11 +400,11 @@
AC_ERR_SET(pkt, AC_ERR_MEM_TEST);
return (EINVAL);
}
/* bump the busy bit */
- atomic_add_32(&test->in_test, 1);
+ atomic_inc_32(&test->in_test);
mutex_exit(&test_mutex);
/* verify the remaining parameters */
if ((t_read.address.page_num >=
test->info.bank_size / test->info.page_size) ||
@@ -496,11 +494,11 @@
t_read.address.line_count * test->info.line_size, flag) != 0) {
retval = EFAULT;
}
read_done:
- atomic_add_32(&test->in_test, -1);
+ atomic_dec_32(&test->in_test);
return (retval);
}
int
ac_mem_test_write(ac_cfga_pkt_t *pkt, int flag)
@@ -548,11 +546,11 @@
mutex_exit(&test_mutex);
return (EINVAL);
}
/* bump the busy bit */
- atomic_add_32(&test->in_test, 1);
+ atomic_inc_32(&test->in_test);
mutex_exit(&test_mutex);
/* verify the remaining parameters */
if ((t_write.address.page_num >=
test->info.bank_size / test->info.page_size) ||
@@ -600,8 +598,8 @@
/* we're back! */
kpreempt_enable();
write_done:
- atomic_add_32(&test->in_test, -1);
+ atomic_dec_32(&test->in_test);
return (retval);
}