Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*

*** 22,33 **** /* * 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> --- 22,31 ----
*** 190,200 **** /* 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); (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; --- 188,198 ---- /* 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_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,412 **** AC_ERR_SET(pkt, AC_ERR_MEM_TEST); return (EINVAL); } /* bump the busy bit */ ! atomic_add_32(&test->in_test, 1); mutex_exit(&test_mutex); /* verify the remaining parameters */ if ((t_read.address.page_num >= test->info.bank_size / test->info.page_size) || --- 400,410 ---- AC_ERR_SET(pkt, AC_ERR_MEM_TEST); return (EINVAL); } /* bump the busy bit */ ! 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,506 **** t_read.address.line_count * test->info.line_size, flag) != 0) { retval = EFAULT; } read_done: ! atomic_add_32(&test->in_test, -1); return (retval); } int ac_mem_test_write(ac_cfga_pkt_t *pkt, int flag) --- 494,504 ---- t_read.address.line_count * test->info.line_size, flag) != 0) { retval = EFAULT; } read_done: ! atomic_dec_32(&test->in_test); return (retval); } int ac_mem_test_write(ac_cfga_pkt_t *pkt, int flag)
*** 548,558 **** mutex_exit(&test_mutex); return (EINVAL); } /* bump the busy bit */ ! atomic_add_32(&test->in_test, 1); mutex_exit(&test_mutex); /* verify the remaining parameters */ if ((t_write.address.page_num >= test->info.bank_size / test->info.page_size) || --- 546,556 ---- mutex_exit(&test_mutex); return (EINVAL); } /* bump the busy bit */ ! 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,607 **** /* we're back! */ kpreempt_enable(); write_done: ! atomic_add_32(&test->in_test, -1); return (retval); } --- 598,605 ---- /* we're back! */ kpreempt_enable(); write_done: ! atomic_dec_32(&test->in_test); return (retval); }