Lines Matching refs:ce

136 	struct snd_clone_entry *ce;  in snd_clone_busy()  local
143 TAILQ_FOREACH(ce, &c->head, link) { in snd_clone_busy()
144 if ((ce->flags & SND_CLONE_BUSY) || in snd_clone_busy()
145 (ce->devt != NULL && ce->devt->si_threadcount != 0)) in snd_clone_busy()
257 struct snd_clone_entry *ce; in snd_clone_getdevflags() local
261 ce = dev->si_drv2; in snd_clone_getdevflags()
262 if (ce == NULL) in snd_clone_getdevflags()
265 SND_CLONE_ASSERT(ce->parent != NULL, ("NULL parent")); in snd_clone_getdevflags()
267 return (ce->flags); in snd_clone_getdevflags()
273 struct snd_clone_entry *ce; in snd_clone_setdevflags() local
279 ce = dev->si_drv2; in snd_clone_setdevflags()
280 if (ce == NULL) in snd_clone_setdevflags()
283 SND_CLONE_ASSERT(ce->parent != NULL, ("NULL parent")); in snd_clone_setdevflags()
285 ce->flags = flags; in snd_clone_setdevflags()
287 return (ce->flags); in snd_clone_setdevflags()
310 struct snd_clone_entry *ce, *tce; in snd_clone_gc() local
337 TAILQ_FOREACH_REVERSE_SAFE(ce, &c->head, link_head, link, tce) { in snd_clone_gc()
338 if (!(ce->flags & SND_CLONE_BUSY) && in snd_clone_gc()
339 (!(ce->flags & SND_CLONE_INVOKE) || in snd_clone_gc()
340 SND_CLONE_EXPIRED(c, &now, &ce->tsp))) { in snd_clone_gc()
342 ce->devt->si_threadcount != 0) { in snd_clone_gc()
343 ce->flags &= ~SND_CLONE_INVOKE; in snd_clone_gc()
344 ce->pid = -1; in snd_clone_gc()
346 TAILQ_REMOVE(&c->head, ce, link); in snd_clone_gc()
347 destroy_dev(ce->devt); in snd_clone_gc()
348 free(ce, M_DEVBUF); in snd_clone_gc()
362 struct snd_clone_entry *ce, *tmp; in snd_clone_destroy() local
366 ce = TAILQ_FIRST(&c->head); in snd_clone_destroy()
367 while (ce != NULL) { in snd_clone_destroy()
368 tmp = TAILQ_NEXT(ce, link); in snd_clone_destroy()
369 if (ce->devt != NULL) in snd_clone_destroy()
370 destroy_dev(ce->devt); in snd_clone_destroy()
371 free(ce, M_DEVBUF); in snd_clone_destroy()
372 ce = tmp; in snd_clone_destroy()
387 struct snd_clone_entry *ce; in snd_clone_acquire() local
391 ce = dev->si_drv2; in snd_clone_acquire()
392 if (ce == NULL) in snd_clone_acquire()
395 SND_CLONE_ASSERT(ce->parent != NULL, ("NULL parent")); in snd_clone_acquire()
397 ce->flags &= ~SND_CLONE_INVOKE; in snd_clone_acquire()
399 if (ce->flags & SND_CLONE_BUSY) in snd_clone_acquire()
402 ce->flags |= SND_CLONE_BUSY; in snd_clone_acquire()
414 struct snd_clone_entry *ce; in snd_clone_release() local
418 ce = dev->si_drv2; in snd_clone_release()
419 if (ce == NULL) in snd_clone_release()
422 SND_CLONE_ASSERT(ce->parent != NULL, ("NULL parent")); in snd_clone_release()
424 ce->flags &= ~SND_CLONE_INVOKE; in snd_clone_release()
426 if (!(ce->flags & SND_CLONE_BUSY)) in snd_clone_release()
429 ce->flags &= ~SND_CLONE_BUSY; in snd_clone_release()
430 ce->pid = -1; in snd_clone_release()
452 struct snd_clone_entry *ce; in snd_clone_ref() local
457 ce = dev->si_drv2; in snd_clone_ref()
458 if (ce == NULL) in snd_clone_ref()
461 c = ce->parent; in snd_clone_ref()
471 struct snd_clone_entry *ce; in snd_clone_unref() local
476 ce = dev->si_drv2; in snd_clone_unref()
477 if (ce == NULL) in snd_clone_unref()
480 c = ce->parent; in snd_clone_unref()
498 snd_clone_register(struct snd_clone_entry *ce, struct cdev *dev) in snd_clone_register() argument
500 SND_CLONE_ASSERT(ce != NULL, ("NULL snd_clone_entry")); in snd_clone_register()
503 SND_CLONE_ASSERT((ce->flags & SND_CLONE_ALLOC) == SND_CLONE_ALLOC, in snd_clone_register()
504 ("invalid clone alloc flags=0x%08x", ce->flags)); in snd_clone_register()
505 SND_CLONE_ASSERT(ce->devt == NULL, ("ce->devt not NULL")); in snd_clone_register()
506 SND_CLONE_ASSERT(ce->unit == dev2unit(dev), in snd_clone_register()
508 ce->unit, dev2unit(dev))); in snd_clone_register()
510 SND_CLONE_ASSERT(ce->parent != NULL, ("NULL parent")); in snd_clone_register()
512 dev->si_drv2 = ce; in snd_clone_register()
513 ce->devt = dev; in snd_clone_register()
514 ce->flags &= ~SND_CLONE_ALLOC; in snd_clone_register()
515 ce->flags |= SND_CLONE_INVOKE; in snd_clone_register()
521 struct snd_clone_entry *ce, *after, *bce, *cce, *nce, *tce; in snd_clone_alloc() local
540 ce = NULL; in snd_clone_alloc()
552 TAILQ_FOREACH(ce, &c->head, link) { in snd_clone_alloc()
556 if (tmask > (ce->unit & c->typemask)) { in snd_clone_alloc()
558 after = ce; in snd_clone_alloc()
560 } else if (tmask < (ce->unit & c->typemask)) in snd_clone_alloc()
567 if (*unit != -1 && *unit == (ce->unit & ~tmask)) in snd_clone_alloc()
576 if (*unit == -1 && (ce->unit & ~tmask) == allocunit) in snd_clone_alloc()
578 if ((ce->unit & ~tmask) < allocunit) in snd_clone_alloc()
579 after = ce; in snd_clone_alloc()
591 if (ce->flags & SND_CLONE_BUSY) { in snd_clone_alloc()
592 if (ce->devt != NULL && (bce == NULL || in snd_clone_alloc()
593 timespeccmp(&ce->tsp, &bce->tsp, <))) in snd_clone_alloc()
594 bce = ce; in snd_clone_alloc()
597 if (ce->pid == curpid && in snd_clone_alloc()
598 (cce == NULL || timespeccmp(&ce->tsp, &cce->tsp, <))) in snd_clone_alloc()
599 cce = ce; in snd_clone_alloc()
600 else if (!(ce->flags & SND_CLONE_INVOKE) && in snd_clone_alloc()
601 (nce == NULL || timespeccmp(&ce->tsp, &nce->tsp, <))) in snd_clone_alloc()
602 nce = ce; in snd_clone_alloc()
603 else if (tce == NULL || timespeccmp(&ce->tsp, &tce->tsp, <)) in snd_clone_alloc()
604 tce = ce; in snd_clone_alloc()
610 ce = cce; in snd_clone_alloc()
619 ce = nce; in snd_clone_alloc()
630 ce = tce; in snd_clone_alloc()
633 ce = bce; in snd_clone_alloc()
651 ce = malloc(sizeof(*ce), M_DEVBUF, in snd_clone_alloc()
653 if (ce == NULL) { in snd_clone_alloc()
661 ce = nce; in snd_clone_alloc()
664 ce = tce; in snd_clone_alloc()
667 ce = bce; in snd_clone_alloc()
673 ce->parent = c; in snd_clone_alloc()
674 ce->unit = tmask | allocunit; in snd_clone_alloc()
675 ce->pid = curpid; in snd_clone_alloc()
676 ce->tsp = now; in snd_clone_alloc()
677 ce->flags |= SND_CLONE_ALLOC; in snd_clone_alloc()
679 TAILQ_INSERT_AFTER(&c->head, after, ce, link); in snd_clone_alloc()
681 TAILQ_INSERT_HEAD(&c->head, ce, link); in snd_clone_alloc()
691 return (ce); in snd_clone_alloc()
698 if (!(ce->flags & SND_CLONE_BUSY)) { in snd_clone_alloc()
699 ce->pid = curpid; in snd_clone_alloc()
700 ce->tsp = now; in snd_clone_alloc()
701 ce->flags |= SND_CLONE_INVOKE; in snd_clone_alloc()
704 *dev = ce->devt; in snd_clone_alloc()