Skip to content

Commit bfe3bd4

Browse files
committed
iommu/qcom: Convert to probe/release_device() call-backs
Convert the QCOM 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 57dbf81 commit bfe3bd4

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

drivers/iommu/qcom_iommu.c

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -524,14 +524,13 @@ static bool qcom_iommu_capable(enum iommu_cap cap)
524524
}
525525
}
526526

527-
static int qcom_iommu_add_device(struct device *dev)
527+
static struct iommu_device *qcom_iommu_probe_device(struct device *dev)
528528
{
529529
struct qcom_iommu_dev *qcom_iommu = to_iommu(dev);
530-
struct iommu_group *group;
531530
struct device_link *link;
532531

533532
if (!qcom_iommu)
534-
return -ENODEV;
533+
return ERR_PTR(-ENODEV);
535534

536535
/*
537536
* Establish the link between iommu and master, so that the
@@ -542,28 +541,19 @@ static int qcom_iommu_add_device(struct device *dev)
542541
if (!link) {
543542
dev_err(qcom_iommu->dev, "Unable to create device link between %s and %s\n",
544543
dev_name(qcom_iommu->dev), dev_name(dev));
545-
return -ENODEV;
544+
return ERR_PTR(-ENODEV);
546545
}
547546

548-
group = iommu_group_get_for_dev(dev);
549-
if (IS_ERR(group))
550-
return PTR_ERR(group);
551-
552-
iommu_group_put(group);
553-
iommu_device_link(&qcom_iommu->iommu, dev);
554-
555-
return 0;
547+
return &qcom_iommu->iommu;
556548
}
557549

558-
static void qcom_iommu_remove_device(struct device *dev)
550+
static void qcom_iommu_release_device(struct device *dev)
559551
{
560552
struct qcom_iommu_dev *qcom_iommu = to_iommu(dev);
561553

562554
if (!qcom_iommu)
563555
return;
564556

565-
iommu_device_unlink(&qcom_iommu->iommu, dev);
566-
iommu_group_remove_device(dev);
567557
iommu_fwspec_free(dev);
568558
}
569559

@@ -619,8 +609,8 @@ static const struct iommu_ops qcom_iommu_ops = {
619609
.flush_iotlb_all = qcom_iommu_flush_iotlb_all,
620610
.iotlb_sync = qcom_iommu_iotlb_sync,
621611
.iova_to_phys = qcom_iommu_iova_to_phys,
622-
.add_device = qcom_iommu_add_device,
623-
.remove_device = qcom_iommu_remove_device,
612+
.probe_device = qcom_iommu_probe_device,
613+
.release_device = qcom_iommu_release_device,
624614
.device_group = generic_device_group,
625615
.of_xlate = qcom_iommu_of_xlate,
626616
.pgsize_bitmap = SZ_4K | SZ_64K | SZ_1M | SZ_16M,

0 commit comments

Comments
 (0)