Skip to content

Commit dea74f1

Browse files
committed
iommu/msm: Convert to probe/release_device() call-backs
Convert the MSM IOMMU driver to use the probe_device() and release_device() call-backs of iommu_ops, so that the iommu core code does the group and sysfs setup. Signed-off-by: Joerg Roedel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 21acf65 commit dea74f1

File tree

1 file changed

+7
-27
lines changed

1 file changed

+7
-27
lines changed

drivers/iommu/msm_iommu.c

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -388,43 +388,23 @@ static struct msm_iommu_dev *find_iommu_for_dev(struct device *dev)
388388
return ret;
389389
}
390390

391-
static int msm_iommu_add_device(struct device *dev)
391+
static struct iommu_device *msm_iommu_probe_device(struct device *dev)
392392
{
393393
struct msm_iommu_dev *iommu;
394-
struct iommu_group *group;
395394
unsigned long flags;
396395

397396
spin_lock_irqsave(&msm_iommu_lock, flags);
398397
iommu = find_iommu_for_dev(dev);
399398
spin_unlock_irqrestore(&msm_iommu_lock, flags);
400399

401-
if (iommu)
402-
iommu_device_link(&iommu->iommu, dev);
403-
else
404-
return -ENODEV;
405-
406-
group = iommu_group_get_for_dev(dev);
407-
if (IS_ERR(group))
408-
return PTR_ERR(group);
409-
410-
iommu_group_put(group);
400+
if (!iommu)
401+
return ERR_PTR(-ENODEV);
411402

412-
return 0;
403+
return &iommu->iommu;
413404
}
414405

415-
static void msm_iommu_remove_device(struct device *dev)
406+
static void msm_iommu_release_device(struct device *dev)
416407
{
417-
struct msm_iommu_dev *iommu;
418-
unsigned long flags;
419-
420-
spin_lock_irqsave(&msm_iommu_lock, flags);
421-
iommu = find_iommu_for_dev(dev);
422-
spin_unlock_irqrestore(&msm_iommu_lock, flags);
423-
424-
if (iommu)
425-
iommu_device_unlink(&iommu->iommu, dev);
426-
427-
iommu_group_remove_device(dev);
428408
}
429409

430410
static int msm_iommu_attach_dev(struct iommu_domain *domain, struct device *dev)
@@ -708,8 +688,8 @@ static struct iommu_ops msm_iommu_ops = {
708688
*/
709689
.iotlb_sync = NULL,
710690
.iova_to_phys = msm_iommu_iova_to_phys,
711-
.add_device = msm_iommu_add_device,
712-
.remove_device = msm_iommu_remove_device,
691+
.probe_device = msm_iommu_probe_device,
692+
.release_device = msm_iommu_release_device,
713693
.device_group = generic_device_group,
714694
.pgsize_bitmap = MSM_IOMMU_PGSIZES,
715695
.of_xlate = qcom_iommu_of_xlate,

0 commit comments

Comments
 (0)