Lines Matching refs:srcimp
596 rsc->idx = container_of(rsc, struct srcimp, rsc)->idx[0]; in srcimp_master()
606 return container_of(rsc, struct srcimp, rsc)->idx[rsc->conj]; in srcimp_index()
616 static int srcimp_map(struct srcimp *srcimp, struct src *src, struct rsc *input) in srcimp_map() argument
621 srcimp->rsc.ops->master(&srcimp->rsc); in srcimp_map()
626 for (i = 0; i < srcimp->rsc.msr; i++) { in srcimp_map()
627 entry = &srcimp->imappers[i]; in srcimp_map()
630 entry->addr = srcimp->rsc.ops->index(&srcimp->rsc); in srcimp_map()
631 srcimp->mgr->imap_add(srcimp->mgr, entry); in srcimp_map()
632 srcimp->mapped |= (0x1 << i); in srcimp_map()
634 srcimp->rsc.ops->next_conj(&srcimp->rsc); in srcimp_map()
638 srcimp->rsc.ops->master(&srcimp->rsc); in srcimp_map()
644 static int srcimp_unmap(struct srcimp *srcimp) in srcimp_unmap() argument
649 for (i = 0; i < srcimp->rsc.msr; i++) { in srcimp_unmap()
650 if (srcimp->mapped & (0x1 << i)) { in srcimp_unmap()
651 srcimp->mgr->imap_delete(srcimp->mgr, in srcimp_unmap()
652 &srcimp->imappers[i]); in srcimp_unmap()
653 srcimp->mapped &= ~(0x1 << i); in srcimp_unmap()
665 static int srcimp_rsc_init(struct srcimp *srcimp, in srcimp_rsc_init() argument
671 err = rsc_init(&srcimp->rsc, srcimp->idx[0], in srcimp_rsc_init()
677 srcimp->imappers = kcalloc(desc->msr, sizeof(struct imapper), in srcimp_rsc_init()
679 if (!srcimp->imappers) { in srcimp_rsc_init()
685 srcimp->rsc.ops = &srcimp_basic_rsc_ops; in srcimp_rsc_init()
686 srcimp->ops = &srcimp_ops; in srcimp_rsc_init()
687 srcimp->mgr = mgr; in srcimp_rsc_init()
689 srcimp->rsc.ops->master(&srcimp->rsc); in srcimp_rsc_init()
694 rsc_uninit(&srcimp->rsc); in srcimp_rsc_init()
698 static int srcimp_rsc_uninit(struct srcimp *srcimp) in srcimp_rsc_uninit() argument
700 kfree(srcimp->imappers); in srcimp_rsc_uninit()
701 srcimp->imappers = NULL; in srcimp_rsc_uninit()
702 srcimp->ops = NULL; in srcimp_rsc_uninit()
703 srcimp->mgr = NULL; in srcimp_rsc_uninit()
704 rsc_uninit(&srcimp->rsc); in srcimp_rsc_uninit()
711 struct srcimp **rsrcimp) in get_srcimp_rsc()
715 struct srcimp *srcimp; in get_srcimp_rsc() local
721 srcimp = kzalloc(sizeof(*srcimp), GFP_KERNEL); in get_srcimp_rsc()
722 if (!srcimp) in get_srcimp_rsc()
733 srcimp->idx[i] = idx; in get_srcimp_rsc()
742 err = srcimp_rsc_init(srcimp, desc, mgr); in get_srcimp_rsc()
746 *rsrcimp = srcimp; in get_srcimp_rsc()
753 mgr_put_resource(&mgr->mgr, 1, srcimp->idx[i]); in get_srcimp_rsc()
756 kfree(srcimp); in get_srcimp_rsc()
760 static int put_srcimp_rsc(struct srcimp_mgr *mgr, struct srcimp *srcimp) in put_srcimp_rsc() argument
766 for (i = 0; i < srcimp->rsc.msr; i++) in put_srcimp_rsc()
767 mgr_put_resource(&mgr->mgr, 1, srcimp->idx[i]); in put_srcimp_rsc()
770 srcimp_rsc_uninit(srcimp); in put_srcimp_rsc()
771 kfree(srcimp); in put_srcimp_rsc()