iommu/ipmmu-vmsa: Use iommu_device_sysfs_add()/remove()
authorMagnus Damm <damm+renesas@opensource.se>
Mon, 21 Aug 2017 05:53:35 +0000 (14:53 +0900)
committerJoerg Roedel <jroedel@suse.de>
Tue, 22 Aug 2017 14:19:00 +0000 (16:19 +0200)
Extend the driver to make use of iommu_device_sysfs_add()/remove()
functions to hook up initial sysfs support.

Suggested-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/ipmmu-vmsa.c

index 5093d1c4f46d0974e8ec65a1a349df643e5b96a2..5a350582f359ae2394bcb97367125aedf2e07afb 100644 (file)
@@ -953,6 +953,11 @@ static int ipmmu_probe(struct platform_device *pdev)
 
        ipmmu_device_reset(mmu);
 
+       ret = iommu_device_sysfs_add(&mmu->iommu, &pdev->dev, NULL,
+                                    dev_name(&pdev->dev));
+       if (ret)
+               return ret;
+
        iommu_device_set_ops(&mmu->iommu, &ipmmu_ops);
        iommu_device_set_fwnode(&mmu->iommu, &pdev->dev.of_node->fwnode);
 
@@ -975,6 +980,7 @@ static int ipmmu_remove(struct platform_device *pdev)
 {
        struct ipmmu_vmsa_device *mmu = platform_get_drvdata(pdev);
 
+       iommu_device_sysfs_remove(&mmu->iommu);
        iommu_device_unregister(&mmu->iommu);
 
 #if defined(CONFIG_ARM) && !defined(CONFIG_IOMMU_DMA)