proc: introduce proc_create_single{,_data}
Variants of proc_create{,_data} that directly take a seq_file show callback and drastically reduces the boilerplate code in the callers. All trivial callers converted over. Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
@@ -185,11 +185,6 @@ static int irq_affinity_list_proc_open(struct inode *inode, struct file *file)
|
||||
return single_open(file, irq_affinity_list_proc_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
static int irq_affinity_hint_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, irq_affinity_hint_proc_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
static const struct file_operations irq_affinity_proc_fops = {
|
||||
.open = irq_affinity_proc_open,
|
||||
.read = seq_read,
|
||||
@@ -198,13 +193,6 @@ static const struct file_operations irq_affinity_proc_fops = {
|
||||
.write = irq_affinity_proc_write,
|
||||
};
|
||||
|
||||
static const struct file_operations irq_affinity_hint_proc_fops = {
|
||||
.open = irq_affinity_hint_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static const struct file_operations irq_affinity_list_proc_fops = {
|
||||
.open = irq_affinity_list_proc_open,
|
||||
.read = seq_read,
|
||||
@@ -223,32 +211,6 @@ static int irq_effective_aff_list_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
return show_irq_affinity(EFFECTIVE_LIST, m);
|
||||
}
|
||||
|
||||
static int irq_effective_aff_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, irq_effective_aff_proc_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
static int irq_effective_aff_list_proc_open(struct inode *inode,
|
||||
struct file *file)
|
||||
{
|
||||
return single_open(file, irq_effective_aff_list_proc_show,
|
||||
PDE_DATA(inode));
|
||||
}
|
||||
|
||||
static const struct file_operations irq_effective_aff_proc_fops = {
|
||||
.open = irq_effective_aff_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static const struct file_operations irq_effective_aff_list_proc_fops = {
|
||||
.open = irq_effective_aff_list_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
#endif
|
||||
|
||||
static int default_affinity_show(struct seq_file *m, void *v)
|
||||
@@ -313,18 +275,6 @@ static int irq_node_proc_show(struct seq_file *m, void *v)
|
||||
seq_printf(m, "%d\n", irq_desc_get_node(desc));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int irq_node_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, irq_node_proc_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
static const struct file_operations irq_node_proc_fops = {
|
||||
.open = irq_node_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
#endif
|
||||
|
||||
static int irq_spurious_proc_show(struct seq_file *m, void *v)
|
||||
@@ -337,18 +287,6 @@ static int irq_spurious_proc_show(struct seq_file *m, void *v)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int irq_spurious_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, irq_spurious_proc_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
static const struct file_operations irq_spurious_proc_fops = {
|
||||
.open = irq_spurious_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
#define MAX_NAMELEN 128
|
||||
|
||||
static int name_unique(unsigned int irq, struct irqaction *new_action)
|
||||
@@ -421,24 +359,24 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc)
|
||||
&irq_affinity_proc_fops, irqp);
|
||||
|
||||
/* create /proc/irq/<irq>/affinity_hint */
|
||||
proc_create_data("affinity_hint", 0444, desc->dir,
|
||||
&irq_affinity_hint_proc_fops, irqp);
|
||||
proc_create_single_data("affinity_hint", 0444, desc->dir,
|
||||
irq_affinity_hint_proc_show, irqp);
|
||||
|
||||
/* create /proc/irq/<irq>/smp_affinity_list */
|
||||
proc_create_data("smp_affinity_list", 0644, desc->dir,
|
||||
&irq_affinity_list_proc_fops, irqp);
|
||||
|
||||
proc_create_data("node", 0444, desc->dir,
|
||||
&irq_node_proc_fops, irqp);
|
||||
proc_create_single_data("node", 0444, desc->dir, irq_node_proc_show,
|
||||
irqp);
|
||||
# ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK
|
||||
proc_create_data("effective_affinity", 0444, desc->dir,
|
||||
&irq_effective_aff_proc_fops, irqp);
|
||||
proc_create_data("effective_affinity_list", 0444, desc->dir,
|
||||
&irq_effective_aff_list_proc_fops, irqp);
|
||||
proc_create_single_data("effective_affinity", 0444, desc->dir,
|
||||
irq_effective_aff_proc_show, irqp);
|
||||
proc_create_single_data("effective_affinity_list", 0444, desc->dir,
|
||||
irq_effective_aff_list_proc_show, irqp);
|
||||
# endif
|
||||
#endif
|
||||
proc_create_data("spurious", 0444, desc->dir,
|
||||
&irq_spurious_proc_fops, (void *)(long)irq);
|
||||
proc_create_single_data("spurious", 0444, desc->dir,
|
||||
irq_spurious_proc_show, (void *)(long)irq);
|
||||
|
||||
out_unlock:
|
||||
mutex_unlock(®ister_lock);
|
||||
|
Reference in New Issue
Block a user