Re: [PATCH v3 4/7] iommu/riscv: Enable IOMMU registration and device probe.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2024/5/1 4:01, Tomasz Jeznach wrote:
Advertise IOMMU device and its core API.
Only minimal implementation for single identity domain type, without
per-group domain protection.

Signed-off-by: Tomasz Jeznach <tjeznach@xxxxxxxxxxxx>

Reviewed-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>

with some nits below.

---
  drivers/iommu/riscv/iommu.c | 64 +++++++++++++++++++++++++++++++++++++
  1 file changed, 64 insertions(+)

[..]

  static int riscv_iommu_init_check(struct riscv_iommu_device *iommu)
  {
  	u64 ddtp;
@@ -71,6 +126,7 @@ static int riscv_iommu_init_check(struct riscv_iommu_device *iommu)
void riscv_iommu_remove(struct riscv_iommu_device *iommu)
  {
+	iommu_device_unregister(&iommu->iommu);
  	iommu_device_sysfs_remove(&iommu->iommu);
  }
@@ -96,8 +152,16 @@ int riscv_iommu_init(struct riscv_iommu_device *iommu)
  		goto err_sysfs;
  	}
+ rc = iommu_device_register(&iommu->iommu, &riscv_iommu_ops, iommu->dev);
+	if (rc) {
+		dev_err_probe(iommu->dev, rc, "cannot register iommu interface\n");
+		goto err_iommu;
+	}
+
  	return 0;
+err_iommu:
+	iommu_device_sysfs_remove(&iommu->iommu);
  err_sysfs:
  	return rc;
  }

It's better to make the goto label indicate what is going to be handled.
So it's more readable to make it like this:

err_remove_sysfs:
	iommu_device_sysfs_remove(&iommu->iommu);

Best regards,
baolu




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux