diff options
| author | Mitchel Humpherys <mitchelh@codeaurora.org> | 2015-07-10 11:56:56 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:13:22 -0700 |
| commit | ec9843794985992fc4a32bd640567717d0227dc2 (patch) | |
| tree | 2cd9add27126cd0da66db030e24a1a1dc2f2e8a4 | |
| parent | fd7077c3858d489647ba997d49b4a3765042b65f (diff) | |
iommu/iommu-debug: Make attachment directories unique
Currently, the device name for the SMMU context bank device is used as
the filename for the IOMMU debug info file. This doesn't work in cases
where multiple domains can be attached to a single SMMU context bank
device (like dynamic domains). Make these filenames unique by appending
a 16-byte uuid to the name.
Change-Id: Ie26ece773bfa2e8c75a329a8cb8461bcd598218e
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
| -rw-r--r-- | drivers/iommu/iommu-debug.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/iommu/iommu-debug.c b/drivers/iommu/iommu-debug.c index 4d2f636b9f88..d12e4c4e4e84 100644 --- a/drivers/iommu/iommu-debug.c +++ b/drivers/iommu/iommu-debug.c @@ -71,27 +71,36 @@ void iommu_debug_attach_device(struct iommu_domain *domain, struct device *dev) { struct iommu_debug_attachment *attach; + char *attach_name; + uuid_le uuid; mutex_lock(&iommu_debug_attachments_lock); + uuid_le_gen(&uuid); + attach_name = kasprintf(GFP_KERNEL, "%s-%pUl", dev_name(dev), uuid.b); + if (!attach_name) + goto unlock; + attach = kmalloc(sizeof(*attach), GFP_KERNEL); if (!attach) - goto unlock; + goto free_attach_name; attach->domain = domain; attach->dev = dev; attach->dentry = debugfs_create_file( - dev_name(dev), S_IRUSR, debugfs_attachments_dir, attach, + attach_name, S_IRUSR, debugfs_attachments_dir, attach, &iommu_debug_attachment_fops); if (!attach->dentry) { pr_err("Couldn't create iommu/attachments/%s debugfs file for domain 0x%p\n", - dev_name(dev), domain); + attach_name, domain); kfree(attach); - goto unlock; + goto free_attach_name; } list_add(&attach->list, &iommu_debug_attachments); +free_attach_name: + kfree(attach_name); unlock: mutex_unlock(&iommu_debug_attachments_lock); } |
