Lines Matching refs:bond
327 struct arm_smmu_bond *bond; in __arm_smmu_sva_bind() local
336 list_for_each_entry(bond, &master->bonds, list) { in __arm_smmu_sva_bind()
337 if (bond->mm == mm) { in __arm_smmu_sva_bind()
338 refcount_inc(&bond->refs); in __arm_smmu_sva_bind()
339 return &bond->sva; in __arm_smmu_sva_bind()
343 bond = kzalloc(sizeof(*bond), GFP_KERNEL); in __arm_smmu_sva_bind()
344 if (!bond) in __arm_smmu_sva_bind()
347 bond->mm = mm; in __arm_smmu_sva_bind()
348 bond->sva.dev = dev; in __arm_smmu_sva_bind()
349 refcount_set(&bond->refs, 1); in __arm_smmu_sva_bind()
351 bond->smmu_mn = arm_smmu_mmu_notifier_get(smmu_domain, mm); in __arm_smmu_sva_bind()
352 if (IS_ERR(bond->smmu_mn)) { in __arm_smmu_sva_bind()
353 ret = PTR_ERR(bond->smmu_mn); in __arm_smmu_sva_bind()
357 list_add(&bond->list, &master->bonds); in __arm_smmu_sva_bind()
358 return &bond->sva; in __arm_smmu_sva_bind()
361 kfree(bond); in __arm_smmu_sva_bind()
517 struct arm_smmu_bond *bond = NULL, *t; in arm_smmu_sva_remove_dev_pasid() local
523 bond = t; in arm_smmu_sva_remove_dev_pasid()
528 if (!WARN_ON(!bond) && refcount_dec_and_test(&bond->refs)) { in arm_smmu_sva_remove_dev_pasid()
529 list_del(&bond->list); in arm_smmu_sva_remove_dev_pasid()
530 arm_smmu_mmu_notifier_put(bond->smmu_mn); in arm_smmu_sva_remove_dev_pasid()
531 kfree(bond); in arm_smmu_sva_remove_dev_pasid()