Skip to contentSkip to conversation

irqdomain: Re-use DEFINE_SHOW_ATTRIBUTE() macro

PATCH Applied Andy Shevchenko 3 participants 5 messages Feb 14, 2018 – Feb 16, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 irqdomain: Re-use DEFINE_SHOW_ATTRIBUTE() macro

...instead of open coding file operations followed by custom ->open() callbacks per each attribute.

---
 kernel/irq/irqdomain.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)
kernel/irq/irqdomain.c +4 -14
index e6a9c36470ee..82b8b18ee1eb 100644
@@ -1726,25 +1726,14 @@ static int irq_domain_debug_show(struct seq_file *m, void *p)
 	irq_domain_debug_show_one(m, d, 0);
 	return 0;
 }
-
-static int irq_domain_debug_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, irq_domain_debug_show, inode->i_private);
-}
-
-static const struct file_operations dfs_domain_ops = {
-	.open		= irq_domain_debug_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(irq_domain_debug);
 
 static void debugfs_add_domain_dir(struct irq_domain *d)
 {
 	if (!d->name || !domain_dir || d->debugfs_file)
 		return;
 	d->debugfs_file = debugfs_create_file(d->name, 0444, domain_dir, d,
-					      &dfs_domain_ops);
+					      &irq_domain_debug_fops);
 }
 
 static void debugfs_remove_domain_dir(struct irq_domain *d)
@@ -1760,7 +1749,8 @@ void __init irq_domain_debugfs_init(struct dentry *root)
 	if (!domain_dir)
 		return;
 
-	debugfs_create_file("default", 0444, domain_dir, NULL, &dfs_domain_ops);
+	debugfs_create_file("default", 0444, domain_dir, NULL,
+			    &irq_domain_debug_fops);
 	mutex_lock(&irq_domain_mutex);
 	list_for_each_entry(d, &irq_domain_list, link)
 		debugfs_add_domain_dir(d);
Signature · 1 line
2.15.1
#2 lore raw
Quoted 9 lines · Marc Zyngier
Quoted 4 lines · Andy Shevchenko

...instead of open coding file operations followed by custom ->open() callbacks per each attribute.

Too late... ;-)

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/kernel/irq/irqdomain.c?id=c5baa1be8f559d5f33c412d00cc1c86762a8bbbf

You're slighly off. The patch is against the CONFIG_GENERIC_IRQ_DEBUGFS infrastructure and that's still there :)

#3 lore raw
Quoted 6 lines · Thomas Gleixner
Quoted 4 lines · Marc Zyngier
Quoted 3 lines · Andy Shevchenko

...instead of open coding file operations followed by custom ->open() callbacks per each attribute.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Too late... ;-)

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/kernel/irq/irqdomain.c?id=c5baa1be8f559d5f33c412d00cc1c86762a8bbbf

You're slighly off. The patch is against the CONFIG_GENERIC_IRQ_DEBUGFS infrastructure and that's still there :)

Gah, I missed that... Sorry about the noise, I'll read that more carefully (/me grabs a brown paper bag...).

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
Applied
#4 lore raw
In reply to Andy Shevchenko
Quoted 7 lines · Andy Shevchenko

...instead of open coding file operations followed by custom ->open() callbacks per each attribute.

---
 kernel/irq/irqdomain.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

Applied, thanks.

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...