diff options
author | jhb <jhb@FreeBSD.org> | 2009-06-09 13:33:03 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2009-06-09 13:33:03 +0000 |
commit | 4270aed4c5c82e67773d38568f637558031d3e7b (patch) | |
tree | e4452267de5a311c82e246d5bf8f6d3ca1b52aad | |
parent | 1ae61ff79c5773a71ea32e2f3571dc726f547c46 (diff) | |
download | FreeBSD-src-4270aed4c5c82e67773d38568f637558031d3e7b.zip FreeBSD-src-4270aed4c5c82e67773d38568f637558031d3e7b.tar.gz |
- Remove an unnecessary memory barrier from an atomic op.
- Use the per-softc mutex to protect the softc data in the callout routine
rather than letting it run without any locks whatsoever.
-rw-r--r-- | sys/dev/nmdm/nmdm.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/nmdm/nmdm.c b/sys/dev/nmdm/nmdm.c index d2fe877..2476eb2 100644 --- a/sys/dev/nmdm/nmdm.c +++ b/sys/dev/nmdm/nmdm.c @@ -100,7 +100,7 @@ nmdm_alloc(unsigned long unit) struct nmdmsoftc *ns; struct tty *tp; - atomic_add_acq_int(&nmdm_count, 1); + atomic_add_int(&nmdm_count, 1); ns = malloc(sizeof(*ns), M_NMDM, M_WAITOK|M_ZERO); mtx_init(&ns->ns_mtx, "nmdm", NULL, MTX_DEF); @@ -109,12 +109,12 @@ nmdm_alloc(unsigned long unit) ns->ns_part1.np_pair = ns; ns->ns_part1.np_other = &ns->ns_part2; TASK_INIT(&ns->ns_part1.np_task, 0, nmdm_task_tty, &ns->ns_part1); - callout_init(&ns->ns_part1.np_callout, CALLOUT_MPSAFE); + callout_init_mtx(&ns->ns_part1.np_callout, &ns->ns_mtx, 0); ns->ns_part2.np_pair = ns; ns->ns_part2.np_other = &ns->ns_part1; TASK_INIT(&ns->ns_part2.np_task, 0, nmdm_task_tty, &ns->ns_part2); - callout_init(&ns->ns_part2.np_callout, CALLOUT_MPSAFE); + callout_init_mtx(&ns->ns_part2.np_callout, &ns->ns_mtx, 0); /* Create device nodes. */ tp = ns->ns_part1.np_tty = tty_alloc_mutex(&nmdm_class, &ns->ns_part1, |