summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/iommu-sysfs.c
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@nvidia.com>2023-06-06 02:59:44 +0200
committerJoerg Roedel <jroedel@suse.de>2023-07-14 16:14:14 +0200
commit14891af3799e8cd24dee14f78c31fa663cfb5ba9 (patch)
treeb9f0c432a2e1a298f298fbb8ede494725d059e25 /drivers/iommu/iommu-sysfs.c
parentiommu: Add iommu_init/deinit_device() paired functions (diff)
downloadlinux-14891af3799e8cd24dee14f78c31fa663cfb5ba9.tar.xz
linux-14891af3799e8cd24dee14f78c31fa663cfb5ba9.zip
iommu: Move the iommu driver sysfs setup into iommu_init/deinit_device()
It makes logical sense that once the driver is attached to the device the sysfs links appear, even if we haven't fully created the group_device or attached the device to a domain. Fix the missing error handling on sysfs creation since iommu_init_device() can trivially handle this. Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/6-v3-328044aa278c+45e49-iommu_probe_jgg@nvidia.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/iommu-sysfs.c')
-rw-r--r--drivers/iommu/iommu-sysfs.c6
1 files changed, 0 insertions, 6 deletions
diff --git a/drivers/iommu/iommu-sysfs.c b/drivers/iommu/iommu-sysfs.c
index 99869217fbec..c8aba0e2a30d 100644
--- a/drivers/iommu/iommu-sysfs.c
+++ b/drivers/iommu/iommu-sysfs.c
@@ -107,9 +107,6 @@ int iommu_device_link(struct iommu_device *iommu, struct device *link)
{
int ret;
- if (!iommu || IS_ERR(iommu))
- return -ENODEV;
-
ret = sysfs_add_link_to_group(&iommu->dev->kobj, "devices",
&link->kobj, dev_name(link));
if (ret)
@@ -126,9 +123,6 @@ EXPORT_SYMBOL_GPL(iommu_device_link);
void iommu_device_unlink(struct iommu_device *iommu, struct device *link)
{
- if (!iommu || IS_ERR(iommu))
- return;
-
sysfs_remove_link(&link->kobj, "iommu");
sysfs_remove_link_from_group(&iommu->dev->kobj, "devices", dev_name(link));
}