diff options
author | Mitchel Humpherys <mitchelh@codeaurora.org> | 2015-07-09 15:02:03 -0700 |
---|---|---|
committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:13:28 -0700 |
commit | 19ce6acc8e22875e92c48902e6f5d7241c1afcb0 (patch) | |
tree | d1793afdaf7b73d70e026924f3b5ba46b7a99ef9 /drivers/iommu/iommu-debug.c | |
parent | fd7f57ccd3a6b27aad34b2356a57a6a8a34c71e2 (diff) |
iommu/iommu-debug: Move attachment info file to subdirectory
Currently IOMMU attachment info is available in debugfs files located at
<debugfs_root>/iommu/attachments/<attached_device>. However, there are
more actions that can be taken on attached devices besides just printing
their info. Make room for more debugfs files for attached devices by
creating a directory for each one, and move the existing info file to:
<debugfs_root>/iommu/attachments/<attached_device>/info.
Change-Id: Ia56efc3aeb5e82afc34314fe48aaa0cd6e5579be
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Diffstat (limited to 'drivers/iommu/iommu-debug.c')
-rw-r--r-- | drivers/iommu/iommu-debug.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/drivers/iommu/iommu-debug.c b/drivers/iommu/iommu-debug.c index 43c89697b5f4..1db29e054d6d 100644 --- a/drivers/iommu/iommu-debug.c +++ b/drivers/iommu/iommu-debug.c @@ -37,7 +37,7 @@ struct iommu_debug_attachment { struct list_head list; }; -static int iommu_debug_attachment_show(struct seq_file *s, void *ignored) +static int iommu_debug_attachment_info_show(struct seq_file *s, void *ignored) { struct iommu_debug_attachment *attach = s->private; phys_addr_t pt_phys; @@ -56,13 +56,15 @@ static int iommu_debug_attachment_show(struct seq_file *s, void *ignored) return 0; } -static int iommu_debug_attachment_open(struct inode *inode, struct file *file) +static int iommu_debug_attachment_info_open(struct inode *inode, + struct file *file) { - return single_open(file, iommu_debug_attachment_show, inode->i_private); + return single_open(file, iommu_debug_attachment_info_show, + inode->i_private); } -static const struct file_operations iommu_debug_attachment_fops = { - .open = iommu_debug_attachment_open, +static const struct file_operations iommu_debug_attachment_info_fops = { + .open = iommu_debug_attachment_info_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, @@ -89,16 +91,25 @@ void iommu_debug_attach_device(struct iommu_domain *domain, attach->domain = domain; attach->dev = dev; - attach->dentry = debugfs_create_file( - attach_name, S_IRUSR, debugfs_attachments_dir, attach, - &iommu_debug_attachment_fops); + attach->dentry = debugfs_create_dir(attach_name, + debugfs_attachments_dir); if (!attach->dentry) { - pr_err("Couldn't create iommu/attachments/%s debugfs file for domain 0x%p\n", + pr_err("Couldn't create iommu/attachments/%s debugfs directory for domain 0x%p\n", attach_name, domain); kfree(attach); goto free_attach_name; } + if (!debugfs_create_file( + "info", S_IRUSR, attach->dentry, attach, + &iommu_debug_attachment_info_fops)) { + pr_err("Couldn't create iommu/attachments/%s/info debugfs file for domain 0x%p\n", + dev_name(dev), domain); + debugfs_remove_recursive(attach->dentry); + kfree(attach); + goto unlock; + } + list_add(&attach->list, &iommu_debug_attachments); free_attach_name: kfree(attach_name); |