diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2018-02-14 10:47:35 -0500 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2018-02-16 09:22:34 -0500 |
commit | 0b24a0bbe2147815d982d9335c41bb10c04f40bc (patch) | |
tree | 6c75d416c427a59f190e197ad83fe59b7bebf656 | |
parent | 2d02424e89eca71b3fa5e832e6fbe467a413e3d5 (diff) |
irqdomain: Re-use DEFINE_SHOW_ATTRIBUTE() macro
...instead of open coding file operations followed by custom ->open()
callbacks per each attribute.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r-- | kernel/irq/irqdomain.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index e6a9c36470ee..82b8b18ee1eb 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c | |||
@@ -1726,25 +1726,14 @@ static int irq_domain_debug_show(struct seq_file *m, void *p) | |||
1726 | irq_domain_debug_show_one(m, d, 0); | 1726 | irq_domain_debug_show_one(m, d, 0); |
1727 | return 0; | 1727 | return 0; |
1728 | } | 1728 | } |
1729 | 1729 | DEFINE_SHOW_ATTRIBUTE(irq_domain_debug); | |
1730 | static int irq_domain_debug_open(struct inode *inode, struct file *file) | ||
1731 | { | ||
1732 | return single_open(file, irq_domain_debug_show, inode->i_private); | ||
1733 | } | ||
1734 | |||
1735 | static const struct file_operations dfs_domain_ops = { | ||
1736 | .open = irq_domain_debug_open, | ||
1737 | .read = seq_read, | ||
1738 | .llseek = seq_lseek, | ||
1739 | .release = single_release, | ||
1740 | }; | ||
1741 | 1730 | ||
1742 | static void debugfs_add_domain_dir(struct irq_domain *d) | 1731 | static void debugfs_add_domain_dir(struct irq_domain *d) |
1743 | { | 1732 | { |
1744 | if (!d->name || !domain_dir || d->debugfs_file) | 1733 | if (!d->name || !domain_dir || d->debugfs_file) |
1745 | return; | 1734 | return; |
1746 | d->debugfs_file = debugfs_create_file(d->name, 0444, domain_dir, d, | 1735 | d->debugfs_file = debugfs_create_file(d->name, 0444, domain_dir, d, |
1747 | &dfs_domain_ops); | 1736 | &irq_domain_debug_fops); |
1748 | } | 1737 | } |
1749 | 1738 | ||
1750 | static void debugfs_remove_domain_dir(struct irq_domain *d) | 1739 | static void debugfs_remove_domain_dir(struct irq_domain *d) |
@@ -1760,7 +1749,8 @@ void __init irq_domain_debugfs_init(struct dentry *root) | |||
1760 | if (!domain_dir) | 1749 | if (!domain_dir) |
1761 | return; | 1750 | return; |
1762 | 1751 | ||
1763 | debugfs_create_file("default", 0444, domain_dir, NULL, &dfs_domain_ops); | 1752 | debugfs_create_file("default", 0444, domain_dir, NULL, |
1753 | &irq_domain_debug_fops); | ||
1764 | mutex_lock(&irq_domain_mutex); | 1754 | mutex_lock(&irq_domain_mutex); |
1765 | list_for_each_entry(d, &irq_domain_list, link) | 1755 | list_for_each_entry(d, &irq_domain_list, link) |
1766 | debugfs_add_domain_dir(d); | 1756 | debugfs_add_domain_dir(d); |